浏览代码

Add unit test for Service.pull

Signed-off-by: Moss Collum <[email protected]>
Moss Collum 11 年之前
父节点
当前提交
3408e0d463
共有 1 个文件被更改,包括 7 次插入0 次删除
  1. 7 0
      tests/unit/service_test.py

+ 7 - 0
tests/unit/service_test.py

@@ -128,6 +128,13 @@ class ServiceTest(unittest.TestCase):
         mock_container_class.from_ps.assert_called_once_with(
             mock_client, container_dict)
 
+    @mock.patch('fig.service.log', autospec=True)
+    def test_pull_image(self, mock_log):
+        service = Service('foo', client=self.mock_client, image='someimage:sometag')
+        service.pull(insecure_registry=True)
+        self.mock_client.pull.assert_called_once_with('someimage:sometag', insecure_registry=True)
+        mock_log.info.assert_called_once_with('Pulling foo (someimage:sometag)...')
+
 
 class ServiceVolumesTest(unittest.TestCase):