summaryrefslogtreecommitdiff
path: root/tests/unittests/reporting/test_reporting_hyperv.py
diff options
context:
space:
mode:
Diffstat (limited to 'tests/unittests/reporting/test_reporting_hyperv.py')
-rw-r--r--tests/unittests/reporting/test_reporting_hyperv.py15
1 files changed, 15 insertions, 0 deletions
diff --git a/tests/unittests/reporting/test_reporting_hyperv.py b/tests/unittests/reporting/test_reporting_hyperv.py
index 35ab0c58..0464f485 100644
--- a/tests/unittests/reporting/test_reporting_hyperv.py
+++ b/tests/unittests/reporting/test_reporting_hyperv.py
@@ -347,3 +347,18 @@ class TextKvpReporter(CiTestCase):
self.assertNotEqual(
kvps[0]["key"], kvps[1]["key"], "duplicate keys for KVP entries"
)
+
+ def test_write_key(self):
+ reporter = HyperVKvpReportingHandler(kvp_file_path=self.tmp_file_path)
+ reporter.write_key("test-key", "test-value")
+ assert list(reporter._iterate_kvps(0)) == [
+ {"key": "test-key", "value": "test-value"}
+ ]
+
+ def test_write_key_truncates(self):
+ reporter = HyperVKvpReportingHandler(kvp_file_path=self.tmp_file_path)
+
+ value = "A" * 2000
+ reporter.write_key("test-key", value)
+
+ assert len(list(reporter._iterate_kvps(0))[0]["value"]) == 1023