summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorMike Russell <michael.j.russell.email@gmail.com>2021-06-16 05:51:00 -0700
committerGitHub <noreply@github.com>2021-06-16 07:51:00 -0500
commitc8d3f99be84a4a04074a94c451387932bd086b26 (patch)
treedc1358993bd37e3a48b74be14f429bf82d4a2e84 /tests
parent950c186a7e0c66a3ed84ea97291e5829ca3d826c (diff)
downloadvyos-cloud-init-c8d3f99be84a4a04074a94c451387932bd086b26.tar.gz
vyos-cloud-init-c8d3f99be84a4a04074a94c451387932bd086b26.zip
Small Doc Update for ReportEventStack and Test (#920)
- small document update for ReportEventStack explaining post_files parameter - small unit test for test_reporting demonstrating the close of an event with optional post_files list
Diffstat (limited to 'tests')
-rw-r--r--tests/unittests/test_reporting.py18
1 files changed, 18 insertions, 0 deletions
diff --git a/tests/unittests/test_reporting.py b/tests/unittests/test_reporting.py
index 9f11fd5c..b78a6939 100644
--- a/tests/unittests/test_reporting.py
+++ b/tests/unittests/test_reporting.py
@@ -113,6 +113,7 @@ class TestReportingEvent(TestCase):
class TestFinishReportingEvent(TestCase):
+
def test_as_has_result(self):
result = events.status.SUCCESS
name, desc = 'test_name', 'test_desc'
@@ -121,6 +122,23 @@ class TestFinishReportingEvent(TestCase):
self.assertTrue('result' in ret)
self.assertEqual(ret['result'], result)
+ def test_has_result_with_optional_post_files(self):
+ result = events.status.SUCCESS
+ name, desc, files = 'test_name', 'test_desc', [
+ '/really/fake/path/install.log']
+ event = events.FinishReportingEvent(
+ name, desc, result, post_files=files)
+ ret = event.as_dict()
+ self.assertTrue('result' in ret)
+ self.assertTrue('files' in ret)
+ self.assertEqual(ret['result'], result)
+ posted_install_log = ret['files'][0]
+ self.assertTrue('path' in posted_install_log)
+ self.assertTrue('content' in posted_install_log)
+ self.assertTrue('encoding' in posted_install_log)
+ self.assertEqual(posted_install_log['path'], files[0])
+ self.assertEqual(posted_install_log['encoding'], 'base64')
+
class TestBaseReportingHandler(TestCase):