示例#1
0
 def test_container_running_cont_running(self, m_docker_client):
     """
     Test the _container_running command when the container is running
     """
     for test in (True, False):
         m_docker_client.inspect_container.return_value = {"State": {"Running": test}}
         self.assertEquals(node._container_running("container1"), test)
示例#2
0
 def test_container_running_cont_running(self, m_docker_client):
     """
     Test the _container_running command when the container is running
     """
     for test in (True, False):
         m_docker_client.inspect_container.return_value = {"State": {"Running": test}}
         self.assertEquals(node._container_running("container1"), test)
示例#3
0
    def test_container_running_no_cont(self, m_docker_client):
        """
        Test the _container_running command when no container exists.
        """
        response = Response()
        response.status_code = 404
        m_docker_client.inspect_container.side_effect = APIError("Test error message", response)

        self.assertEquals(node._container_running("container1"), False)
        m_docker_client.inspect_container.assert_called_once_with("container1")
示例#4
0
    def test_container_running_no_cont(self, m_docker_client):
        """
        Test the _container_running command when no container exists.
        """
        response = Response()
        response.status_code = 404
        m_docker_client.inspect_container.side_effect = APIError("Test error message", response)

        self.assertEquals(node._container_running("container1"), False)
        m_docker_client.inspect_container.assert_called_once_with("container1")