summaryrefslogtreecommitdiff
path: root/tests/unittests
diff options
context:
space:
mode:
authorScott Moser <smoser@ubuntu.com>2016-06-22 10:07:12 -0400
committerScott Moser <smoser@ubuntu.com>2016-06-22 10:07:12 -0400
commit7a39cb35f54be3d91ab0985a96fcb3663f20124c (patch)
tree9831898dbfe7767d750227bd5d748713260f1586 /tests/unittests
parent145256f964388423965bc77c2a780a89ed62dc2e (diff)
downloadvyos-cloud-init-7a39cb35f54be3d91ab0985a96fcb3663f20124c.tar.gz
vyos-cloud-init-7a39cb35f54be3d91ab0985a96fcb3663f20124c.zip
rename test class, add a test, improve test names
Diffstat (limited to 'tests/unittests')
-rw-r--r--tests/unittests/test_data.py9
1 files changed, 7 insertions, 2 deletions
diff --git a/tests/unittests/test_data.py b/tests/unittests/test_data.py
index 17951117..13db8a4c 100644
--- a/tests/unittests/test_data.py
+++ b/tests/unittests/test_data.py
@@ -559,12 +559,17 @@ class TestUDProcess(helpers.ResourceUsingTestCase):
self.assertTrue(count_messages(message) == 1)
-class TestConvert(helpers.TestCase):
- def test_handles_binary(self):
+class TestConvertString(helpers.TestCase):
+ def test_handles_binary_non_utf8_decodable(self):
blob = b'\x32\x99'
msg = ud.convert_string(blob)
self.assertEqual(blob, msg.get_payload(decode=True))
+ def test_handles_binary_utf8_decodable(self):
+ blob = b'\x32\x32'
+ msg = ud.convert_string(blob)
+ self.assertEqual(blob, msg.get_payload(decode=True))
+
def test_handle_headers(self):
text = "hi mom"
msg = ud.convert_string(text)