diff options
author | Scott Moser <smoser@ubuntu.com> | 2015-02-10 20:50:23 -0500 |
---|---|---|
committer | Scott Moser <smoser@ubuntu.com> | 2015-02-10 20:50:23 -0500 |
commit | db66b4a42e24dc83d9316df14485c8413ac94abe (patch) | |
tree | 0077e3c2a86d38b8e58bb35215df93db0315504d | |
parent | f62b86bd45c8df78ada32ab4040a639c9d096202 (diff) | |
download | vyos-cloud-init-db66b4a42e24dc83d9316df14485c8413ac94abe.tar.gz vyos-cloud-init-db66b4a42e24dc83d9316df14485c8413ac94abe.zip |
pep8
-rw-r--r-- | cloudinit/util.py | 3 | ||||
-rw-r--r-- | tests/unittests/test_cs_util.py | 16 |
2 files changed, 10 insertions, 9 deletions
diff --git a/cloudinit/util.py b/cloudinit/util.py index c998154a..b845adfd 100644 --- a/cloudinit/util.py +++ b/cloudinit/util.py @@ -101,6 +101,7 @@ def b64d(source): except UnicodeDecodeError: return decoded + def b64e(source): # Base64 encode some data, accepting bytes or unicode/str, and returning # str/unicode if the result is utf-8 compatible, otherwise returning bytes. @@ -116,7 +117,7 @@ def fully_decoded_payload(part): # bytes, first try to decode to str via CT charset, and failing that, try # utf-8 using surrogate escapes. cte_payload = part.get_payload(decode=True) - if ( six.PY3 and + if (six.PY3 and part.get_content_maintype() == 'text' and isinstance(cte_payload, bytes)): charset = part.get_charset() or 'utf-8' diff --git a/tests/unittests/test_cs_util.py b/tests/unittests/test_cs_util.py index 337ac9a0..d7273035 100644 --- a/tests/unittests/test_cs_util.py +++ b/tests/unittests/test_cs_util.py @@ -47,14 +47,14 @@ class CepkoMock(Cepko): class CepkoResultTests(unittest.TestCase): def setUp(self): pass - ## self.mocked = self.mocker.replace("cloudinit.cs_utils.Cepko", - ## spec=CepkoMock, - ## count=False, - ## passthrough=False) - ## self.mocked() - ## self.mocker.result(CepkoMock()) - ## self.mocker.replay() - ## self.c = Cepko() + # self.mocked = self.mocker.replace("cloudinit.cs_utils.Cepko", + # spec=CepkoMock, + # count=False, + # passthrough=False) + # self.mocked() + # self.mocker.result(CepkoMock()) + # self.mocker.replay() + # self.c = Cepko() def test_getitem(self): result = self.c.all() |