Add test for _convert_to_datetime

This commit is contained in:
twangboy 2016-03-16 07:15:41 -06:00
parent 3a6ad91509
commit 845809139c

View File

@ -60,6 +60,25 @@ class MacShadowModuleTest(integration.ModuleCase):
'''
self.run_function('user.delete', [TEST_USER])
def test_convert_to_datetime(self):
'''
Test shadow._convert_to_datetime
'''
# Correct Functionality
self.assertEqual(
self.run_function('shadow._convert_to_datetime', [1297428974]),
'2011-02-11 07:56:14')
# Bad Epoch Timestamp (TypeError)
self.assertEqual(
self.run_function('shadow._convert_to_datetime', ['spongebob']),
'Invalid Timestamp')
# Bad Epoch Timestamp (ValueError)
self.assertEqual(
self.run_function('shadow._convert_to_datetime', [-1234567890123]),
'Invalid Timestamp')
@destructiveTest
def test_info(self):
'''