def test_exec_in_container_without_args(self, patch_docker_client): patch_docker_client.return_value = self.fake_docker_client self.fake_docker_client.exec_create.return_value = {'Id': 'exec-id'} fake_container = {'Id': 'container-id'} exec_in_container(fake_container, 'ls') self.fake_docker_client.exec_create.assert_called_once_with( 'container-id', 'ls')
def exec_in_container(self, service_name, command): container = get_container_for_app_or_service(service_name, raise_if_not_found=True) return exec_in_container(container, *command.split(' '))
def test_exec_in_container_without_args(self): self.fake_docker_client.exec_create.return_value = {'Id': 'exec-id'} fake_container = {'Id': 'container-id'} exec_in_container(self.fake_docker_client, fake_container, 'ls') self.fake_docker_client.exec_create.assert_called_once_with('container-id', 'ls')
def exec_in_container(self, service_name, command): container = get_container_for_app_or_service(service_name, raise_if_not_found=True) return exec_in_container(container, *command.split(" "))
def test_exec_in_container_with_args(self, patch_docker_client): patch_docker_client.return_value = self.fake_docker_client self.fake_docker_client.exec_create.return_value = {'Id': 'exec-id'} fake_container = {'Id': 'container-id'} exec_in_container(fake_container, 'cp -r', '/tmp/a', '/tmp/b') self.fake_docker_client.exec_create.assert_called_once_with('container-id', 'cp -r /tmp/a /tmp/b')
def exec_in_container(self, service_name, command): client = get_docker_client() container = get_container_for_app_or_service(client, service_name, raise_if_not_found=True) return exec_in_container(client, container, *command.split(' '))