mktime takes local time, not UTC
GPG signature timestamps are considered UTC, this may cause times to be off by delta > 1000 in def test_signature_string_verification because it incorrectly gave gmtime() as an argument to mktime(). Python 2 and 3 docs both say that mktime should have a struct_time argument "which expresses the time in local time, not UTC". So the test is now using time.localtime() instead of time.gmtime()testing/mmn/xrange_replaces_range_in_python3
parent
43191ab4af
commit
f80f216625
|
@ -28,7 +28,7 @@ from argparse import ArgumentParser
|
|||
from codecs import open as open
|
||||
from functools import wraps
|
||||
from glob import glob
|
||||
from time import gmtime
|
||||
from time import localtime
|
||||
from time import mktime
|
||||
|
||||
import encodings
|
||||
|
@ -645,7 +645,7 @@ class GPGTestCase(unittest.TestCase):
|
|||
message += '[hackers in popular culture] to push for more power'
|
||||
sig = self.gpg.sign(message, default_key=key.fingerprint,
|
||||
passphrase='bruceschneier')
|
||||
now = mktime(gmtime())
|
||||
now = mktime(localtime())
|
||||
self.assertTrue(sig, "Good passphrase should succeed")
|
||||
verified = self.gpg.verify(sig.data)
|
||||
self.assertIsNotNone(verified.fingerprint)
|
||||
|
|
Loading…
Reference in New Issue