From 15b83f67d2fc6645a5e68ce923ca9a2d4d1b9805 Mon Sep 17 00:00:00 2001 From: Alistair Coles Date: Wed, 18 Mar 2015 12:43:03 +0000 Subject: [PATCH] Test swift-object-info opens meta and ts files Adds a unit test to verify the change made in [1], i.e. that swift-object-info will read from .meta and .ts files as well as .data files. [1] change I43966d371218ad39414e9282cde579e48370a2a7 Change-Id: I82dde36e3a96db1a21cfe9a4cca0d941e543dfd0 Related-Bug: 1425679 --- test/unit/cli/test_info.py | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/test/unit/cli/test_info.py b/test/unit/cli/test_info.py index 2766520fd0..fede0d30fa 100644 --- a/test/unit/cli/test_info.py +++ b/test/unit/cli/test_info.py @@ -386,6 +386,17 @@ class TestPrintObjFullMeta(TestCliInfoBase): print_obj(self.datafile, swift_dir=self.testdir) self.assertTrue('/objects-1/' in out.getvalue()) + def test_print_obj_meta_and_ts_files(self): + # verify that print_obj will also read from meta and ts files + base = os.path.splitext(self.datafile)[0] + for ext in ('.meta', '.ts'): + test_file = '%s%s' % (base, ext) + os.link(self.datafile, test_file) + out = StringIO() + with mock.patch('sys.stdout', out): + print_obj(test_file, swift_dir=self.testdir) + self.assertTrue('/objects-1/' in out.getvalue()) + def test_print_obj_no_ring(self): no_rings_dir = os.path.join(self.testdir, 'no_rings_here') os.mkdir(no_rings_dir)