mirror of
https://github.com/OpenKMIP/PyKMIP.git
synced 2025-05-13 19:30:08 +02:00
Merge pull request #125 from OpenKMIP/bug/fix-datetime-str-test
Fixing bug with DateTime str test
This commit is contained in:
commit
dc00da56ab
@ -977,7 +977,7 @@ class DateTime(LongInteger):
|
|||||||
return "DateTime(value={0}, tag={1})".format(self.value, self.tag)
|
return "DateTime(value={0}, tag={1})".format(self.value, self.tag)
|
||||||
|
|
||||||
def __str__(self):
|
def __str__(self):
|
||||||
return time.ctime(self.value)
|
return time.asctime(time.gmtime(self.value))
|
||||||
|
|
||||||
|
|
||||||
class Interval(Base):
|
class Interval(Base):
|
||||||
|
@ -14,7 +14,6 @@
|
|||||||
# under the License.
|
# under the License.
|
||||||
|
|
||||||
import testtools
|
import testtools
|
||||||
import time
|
|
||||||
|
|
||||||
from kmip.core import primitives
|
from kmip.core import primitives
|
||||||
from kmip.core import utils
|
from kmip.core import utils
|
||||||
@ -90,8 +89,7 @@ class TestDateTime(testtools.TestCase):
|
|||||||
Test that the string representation of a DateTime is formatted
|
Test that the string representation of a DateTime is formatted
|
||||||
properly.
|
properly.
|
||||||
"""
|
"""
|
||||||
t = (2015, 8, 11, 9, 18, 55, 1, 223, 1)
|
expected = 'Tue Aug 11 13:18:55 2015'
|
||||||
s = "Tue Aug 11 09:18:55 2015"
|
date_time = primitives.DateTime(1439299135)
|
||||||
|
|
||||||
date_time = primitives.DateTime(int(time.mktime(t)))
|
self.assertEqual(expected, str(date_time))
|
||||||
self.assertEqual(s, str(date_time))
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user