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)
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")