diff options
author | Michael Still <mikal@stillhq.com> | 2017-06-08 14:57:49 +1000 |
---|---|---|
committer | Tony Breeds <tony@bakeyournoodle.com> | 2017-07-26 08:36:32 +1000 |
commit | ddfd93a38cd03372a5e88d81c825262f9a22cf71 (patch) | |
tree | f83e3543479aa521e3dfacbf288b129df195ed47 /nova/tests/unit/test_utils.py | |
parent | 24a96f4cbe309aac76c0a76e19bd1417c988008a (diff) | |
download | nova-ddfd93a38cd03372a5e88d81c825262f9a22cf71.tar.gz |
Move the last_bytes util method to libvirt
The only user of this util method is libvirt, so it should live there.
This is a precursor to re-writing its single caller to use privsep to
read bytes instead of chown'ing files.
Change-Id: Ice5cc70eeef3fbeee9a1a0ec0daa801c6f74480c
Diffstat (limited to 'nova/tests/unit/test_utils.py')
-rw-r--r-- | nova/tests/unit/test_utils.py | 27 |
1 files changed, 0 insertions, 27 deletions
diff --git a/nova/tests/unit/test_utils.py b/nova/tests/unit/test_utils.py index 60b40c3c6b..bd6a05a98b 100644 --- a/nova/tests/unit/test_utils.py +++ b/nova/tests/unit/test_utils.py @@ -779,33 +779,6 @@ class MkfsTestCase(test.NoDBTestCase): '/my/swap/block/dev', run_as_root=False) -class LastBytesTestCase(test.NoDBTestCase): - """Test the last_bytes() utility method.""" - - def setUp(self): - super(LastBytesTestCase, self).setUp() - self.f = six.BytesIO(b'1234567890') - - def test_truncated(self): - self.f.seek(0, os.SEEK_SET) - out, remaining = utils.last_bytes(self.f, 5) - self.assertEqual(out, b'67890') - self.assertGreater(remaining, 0) - - def test_read_all(self): - self.f.seek(0, os.SEEK_SET) - out, remaining = utils.last_bytes(self.f, 1000) - self.assertEqual(out, b'1234567890') - self.assertFalse(remaining > 0) - - def test_seek_too_far_real_file(self): - # StringIO doesn't raise IOError if you see past the start of the file. - with tempfile.TemporaryFile() as flo: - content = b'1234567890' - flo.write(content) - self.assertEqual((content, 0), utils.last_bytes(flo, 1000)) - - class MetadataToDictTestCase(test.NoDBTestCase): def test_metadata_to_dict(self): self.assertEqual(utils.metadata_to_dict( |