[virt-tools-list] [virt-bootstrap] [PATCH v4 03/26] tests: Remove redundant arguments

Radostin Stoyanov rstoyanov1 at gmail.com
Thu Aug 3 13:13:01 UTC 2017


---
 tests/test_docker_source.py | 41 ++++++++++++++++++++++-------------------
 1 file changed, 22 insertions(+), 19 deletions(-)

diff --git a/tests/test_docker_source.py b/tests/test_docker_source.py
index 4d6d0c3..8108e31 100644
--- a/tests/test_docker_source.py
+++ b/tests/test_docker_source.py
@@ -139,22 +139,22 @@ class TestDockerSource(unittest.TestCase):
         Ensures that retrieve_layers_info() calls get_image_details()
         with all passed arguments.
         """
-        src_kwargs = {'uri': '',
-                      'fmt': 'dir',
-                      'not_secure': False,
-                      'no_cache': False,
-                      'progress': mock.Mock(),
-                      'username': 'username',
-                      'password': 'password'}
+        src_kwargs = {
+            'uri': '',
+            'progress': mock.Mock()
+        }
 
         manifest = {'schemaVersion': 2, 'layers': []}
         (src_instance,
          m_uri, m_utils) = self._mock_retrieve_layers_info(manifest,
                                                            src_kwargs)
 
-        kwargs = {arg: getattr(src_instance, arg)
-                  for arg in ['insecure', 'username', 'password']}
-        kwargs['raw'] = True
+        kwargs = {
+            'insecure': src_instance.insecure,
+            'username': src_instance.username,
+            'password': src_instance.password,
+            'raw': True
+        }
         m_utils['get_image_details'].assert_called_once_with(m_uri(), **kwargs)
 
     def test_retrieve_layers_info_schema_version_1(self):
@@ -163,9 +163,10 @@ class TestDockerSource(unittest.TestCase):
         from manifest with schema version 1 a list with format:
             ["digest", "sum_type", "file_path", "size"].
         """
-        args = ['uri', 'fmt', 'not_secure', 'password', 'username', 'no_cache']
-        kwargs = {arg: arg for arg in args}
-        kwargs['progress'] = mock.Mock()
+        kwargs = {
+            'uri': '',
+            'progress': mock.Mock()
+        }
 
         manifest = {
             'schemaVersion': 1,
@@ -191,9 +192,10 @@ class TestDockerSource(unittest.TestCase):
         from manifest with schema version 2 a list with format:
             ["digest", "sum_type", "file_path", "size"].
         """
-        args = ['uri', 'fmt', 'not_secure', 'password', 'username', 'no_cache']
-        kwargs = {arg: arg for arg in args}
-        kwargs['progress'] = mock.Mock()
+        kwargs = {
+            'uri': '',
+            'progress': mock.Mock()
+        }
 
         manifest = {
             'schemaVersion': 2,
@@ -218,9 +220,10 @@ class TestDockerSource(unittest.TestCase):
         Ensures that retrieve_layers_info() calls get_image_details()
         with all passed arguments.
         """
-        args = ['uri', 'fmt', 'not_secure', 'password', 'username', 'no_cache']
-        kwargs = {arg: arg for arg in args}
-        kwargs['progress'] = mock.Mock()
+        kwargs = {
+            'uri': '',
+            'progress': mock.Mock()
+        }
 
         manifest = {'schemaVersion': 3}
         with self.assertRaises(ValueError):
-- 
2.13.3




More information about the virt-tools-list mailing list