Down to it.

This commit is contained in:
Barry Warsaw 2015-01-26 15:09:48 -05:00
parent d104113095
commit d15fd3138a
2 changed files with 6 additions and 6 deletions

View File

@ -22,7 +22,7 @@ import base64
import gzip import gzip
import tempfile import tempfile
from six import StringIO from six import BytesIO
from cloudinit import cloud from cloudinit import cloud
from cloudinit import distros from cloudinit import distros
@ -76,7 +76,7 @@ class TestRandomSeed(t_help.TestCase):
return return
def _compress(self, text): def _compress(self, text):
contents = StringIO() contents = BytesIO()
gz_fh = gzip.GzipFile(mode='wb', fileobj=contents) gz_fh = gzip.GzipFile(mode='wb', fileobj=contents)
gz_fh.write(text) gz_fh.write(text)
gz_fh.close() gz_fh.close()
@ -103,7 +103,7 @@ class TestRandomSeed(t_help.TestCase):
self.assertEquals("tiny-tim-was-here", contents) self.assertEquals("tiny-tim-was-here", contents)
def test_append_random_unknown_encoding(self): def test_append_random_unknown_encoding(self):
data = self._compress("tiny-toe") data = self._compress(b"tiny-toe")
cfg = { cfg = {
'random_seed': { 'random_seed': {
'file': self._seed_file, 'file': self._seed_file,
@ -115,7 +115,7 @@ class TestRandomSeed(t_help.TestCase):
self._get_cloud('ubuntu'), LOG, []) self._get_cloud('ubuntu'), LOG, [])
def test_append_random_gzip(self): def test_append_random_gzip(self):
data = self._compress("tiny-toe") data = self._compress(b"tiny-toe")
cfg = { cfg = {
'random_seed': { 'random_seed': {
'file': self._seed_file, 'file': self._seed_file,
@ -128,7 +128,7 @@ class TestRandomSeed(t_help.TestCase):
self.assertEquals("tiny-toe", contents) self.assertEquals("tiny-toe", contents)
def test_append_random_gz(self): def test_append_random_gz(self):
data = self._compress("big-toe") data = self._compress(b"big-toe")
cfg = { cfg = {
'random_seed': { 'random_seed': {
'file': self._seed_file, 'file': self._seed_file,

View File

@ -166,7 +166,7 @@ class TestDeleteDirContents(unittest.TestCase):
def test_deletes_files(self): def test_deletes_files(self):
"""Single file should be deleted.""" """Single file should be deleted."""
with open(os.path.join(self.tmp, "new_file.txt"), "wb") as f: with open(os.path.join(self.tmp, "new_file.txt"), "wb") as f:
f.write("DELETE ME") f.write(b"DELETE ME")
util.delete_dir_contents(self.tmp) util.delete_dir_contents(self.tmp)