summaryrefslogtreecommitdiff
path: root/tests/unittests/test_reporting.py
diff options
context:
space:
mode:
authorScott Moser <smoser@ubuntu.com>2015-09-02 16:44:51 -0400
committerScott Moser <smoser@ubuntu.com>2015-09-02 16:44:51 -0400
commitcba8282acc1c957698480bae2d0c2032b884d80d (patch)
tree1e2ac6884b6667aabc7e6b8948ec01e4a3c55f07 /tests/unittests/test_reporting.py
parent3f2dddae6e8d5148bcf89c2b4e27975d1da77aea (diff)
downloadvyos-cloud-init-cba8282acc1c957698480bae2d0c2032b884d80d.tar.gz
vyos-cloud-init-cba8282acc1c957698480bae2d0c2032b884d80d.zip
fix test_as_dict
Diffstat (limited to 'tests/unittests/test_reporting.py')
-rw-r--r--tests/unittests/test_reporting.py12
1 files changed, 9 insertions, 3 deletions
diff --git a/tests/unittests/test_reporting.py b/tests/unittests/test_reporting.py
index 0a441adf..32356ef9 100644
--- a/tests/unittests/test_reporting.py
+++ b/tests/unittests/test_reporting.py
@@ -100,9 +100,15 @@ class TestReportingEvent(TestCase):
def test_as_dict(self):
event_type, name, desc = 'test_type', 'test_name', 'test_desc'
event = events.ReportingEvent(event_type, name, desc)
- self.assertEqual(
- {'event_type': event_type, 'name': name, 'description': desc},
- event.as_dict())
+ expected = {'event_type': event_type, 'name': name,
+ 'description': desc, 'origin': 'cloudinit'}
+
+ # allow for timestamp to differ, but must be present
+ as_dict = event.as_dict()
+ self.assertIn('timestamp', as_dict)
+ del as_dict['timestamp']
+
+ self.assertEqual(expected, as_dict)
class TestFinishReportingEvent(TestCase):