Merge pull request #125 from OpenKMIP/bug/fix-datetime-str-test

Fixing bug with DateTime str test
This commit is contained in:
Peter Hamilton 2016-04-05 14:07:12 -04:00
commit dc00da56ab
2 changed files with 4 additions and 6 deletions

View File

@ -977,7 +977,7 @@ class DateTime(LongInteger):
return "DateTime(value={0}, tag={1})".format(self.value, self.tag)
def __str__(self):
return time.ctime(self.value)
return time.asctime(time.gmtime(self.value))
class Interval(Base):

View File

@ -14,7 +14,6 @@
# under the License.
import testtools
import time
from kmip.core import primitives
from kmip.core import utils
@ -90,8 +89,7 @@ class TestDateTime(testtools.TestCase):
Test that the string representation of a DateTime is formatted
properly.
"""
t = (2015, 8, 11, 9, 18, 55, 1, 223, 1)
s = "Tue Aug 11 09:18:55 2015"
expected = 'Tue Aug 11 13:18:55 2015'
date_time = primitives.DateTime(1439299135)
date_time = primitives.DateTime(int(time.mktime(t)))
self.assertEqual(s, str(date_time))
self.assertEqual(expected, str(date_time))