From 8cc075a8fb7561c736cb38d629f5b3d8ddb67497 Mon Sep 17 00:00:00 2001 From: "Jay S. Bryant" Date: Thu, 20 Nov 2014 15:56:58 -0600 Subject: [PATCH] mock out os.listdir to return a list os.listdir returns a list of items. The test case had been written to return a single item which, though not really changing the result of the test, was not the best approach. This patch updates the test case to return a list instead of a single item. Change-Id: I793e0636440c0de0ca339c6592adec3e8b4ee1b4 --- test/unit/container/test_updater.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test/unit/container/test_updater.py b/test/unit/container/test_updater.py index e0a8231773..4e9e1ffc9d 100644 --- a/test/unit/container/test_updater.py +++ b/test/unit/container/test_updater.py @@ -180,7 +180,7 @@ class TestContainerUpdater(unittest.TestCase): 'permission_denied') self.assertEqual(log_lines[0], msg) - @mock.patch('os.listdir', return_value='bar/') + @mock.patch('os.listdir', return_value=['foo', 'bar']) def test_listdir_without_exception(self, mock_listdir): cu = container_updater.ContainerUpdater({ 'devices': self.devices_dir, @@ -193,7 +193,7 @@ class TestContainerUpdater(unittest.TestCase): }) cu.logger = FakeLogger() path = cu._listdir('foo/bar/') - self.assertEqual(path, 'bar/') + self.assertEqual(path, ['foo', 'bar']) log_lines = cu.logger.get_lines_for_level('error') self.assertEqual(len(log_lines), 0)