diff options
author | Barry Warsaw <barry@python.org> | 2015-01-27 15:03:52 -0500 |
---|---|---|
committer | Barry Warsaw <barry@python.org> | 2015-01-27 15:03:52 -0500 |
commit | 6e742d20e9ed56498925c7c850cd5da65d063b4b (patch) | |
tree | 3e584ae2381d72d2b77c6f2d98c9be93bcb9e413 /tests/unittests/test_handler | |
parent | 69c64029997599b3f1764ef48fe571094e2ee5f2 (diff) | |
download | vyos-cloud-init-6e742d20e9ed56498925c7c850cd5da65d063b4b.tar.gz vyos-cloud-init-6e742d20e9ed56498925c7c850cd5da65d063b4b.zip |
Respond to review:
- Refactor both the base64 encoding and decoding into utility functions.
Also:
- Mechanically fix some other broken untested code.
Diffstat (limited to 'tests/unittests/test_handler')
-rw-r--r-- | tests/unittests/test_handler/test_handler_seed_random.py | 12 |
1 files changed, 2 insertions, 10 deletions
diff --git a/tests/unittests/test_handler/test_handler_seed_random.py b/tests/unittests/test_handler/test_handler_seed_random.py index d3f18fa0..0bcdcb31 100644 --- a/tests/unittests/test_handler/test_handler_seed_random.py +++ b/tests/unittests/test_handler/test_handler_seed_random.py @@ -18,7 +18,6 @@ from cloudinit.config import cc_seed_random -import base64 import gzip import tempfile @@ -38,13 +37,6 @@ import logging LOG = logging.getLogger(__name__) -def b64(source): - # In Python 3, b64encode only accepts bytes and returns bytes. - if not isinstance(source, bytes): - source = source.encode('utf-8') - return base64.b64encode(source).decode('us-ascii') - - class TestRandomSeed(t_help.TestCase): def setUp(self): super(TestRandomSeed, self).setUp() @@ -141,7 +133,7 @@ class TestRandomSeed(t_help.TestCase): self.assertEquals("big-toe", contents) def test_append_random_base64(self): - data = b64('bubbles') + data = util.b64e('bubbles') cfg = { 'random_seed': { 'file': self._seed_file, @@ -154,7 +146,7 @@ class TestRandomSeed(t_help.TestCase): self.assertEquals("bubbles", contents) def test_append_random_b64(self): - data = b64('kit-kat') + data = util.b64e('kit-kat') cfg = { 'random_seed': { 'file': self._seed_file, |