From 4be853fd4444d16957ec478fc3597e47f8e2646e Mon Sep 17 00:00:00 2001 From: Ian Woodard <17186604+IanWoodard@users.noreply.github.com> Date: Mon, 6 Jan 2025 15:22:18 -0800 Subject: [PATCH] chore(up): cleaning up tests (#196) --- tests/commands/test_up.py | 124 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 124 insertions(+) diff --git a/tests/commands/test_up.py b/tests/commands/test_up.py index dc89527..f4d230c 100644 --- a/tests/commands/test_up.py +++ b/tests/commands/test_up.py @@ -87,6 +87,37 @@ def test_up_simple( mock_create_devservices_network.assert_called_once() + mock_subprocess_check_output.assert_has_calls( + [ + mock.call( + [ + "docker", + "compose", + "-f", + f"{service_path}/{DEVSERVICES_DIR_NAME}/{CONFIG_FILE_NAME}", + "config", + "--services", + ], + text=True, + env=mock.ANY, + ), + mock.call( + [ + "docker", + "compose", + "-p", + "example-service", + "-f", + f"{service_path}/{DEVSERVICES_DIR_NAME}/{CONFIG_FILE_NAME}", + "ps", + "--format", + "{{.Name}}", + ], + text=True, + ), + ] + ) + mock_run.assert_called_with( [ "docker", @@ -346,6 +377,37 @@ def test_up_docker_compose_container_lookup_error( mock_create_devservices_network.assert_called_once() + mock_subprocess_check_output.assert_has_calls( + [ + mock.call( + [ + "docker", + "compose", + "-f", + f"{service_path}/{DEVSERVICES_DIR_NAME}/{CONFIG_FILE_NAME}", + "config", + "--services", + ], + text=True, + env=mock.ANY, + ), + mock.call( + [ + "docker", + "compose", + "-p", + "example-service", + "-f", + f"{service_path}/{DEVSERVICES_DIR_NAME}/{CONFIG_FILE_NAME}", + "ps", + "--format", + "{{.Name}}", + ], + text=True, + ), + ] + ) + mock_run.assert_called_with( [ "docker", @@ -451,6 +513,37 @@ def test_up_docker_compose_container_healthcheck_failed( mock_create_devservices_network.assert_called_once() + mock_subprocess_check_output.assert_has_calls( + [ + mock.call( + [ + "docker", + "compose", + "-f", + f"{service_path}/{DEVSERVICES_DIR_NAME}/{CONFIG_FILE_NAME}", + "config", + "--services", + ], + text=True, + env=mock.ANY, + ), + mock.call( + [ + "docker", + "compose", + "-p", + "example-service", + "-f", + f"{service_path}/{DEVSERVICES_DIR_NAME}/{CONFIG_FILE_NAME}", + "ps", + "--format", + "{{.Name}}", + ], + text=True, + ), + ] + ) + mock_run.assert_called_with( [ "docker", @@ -548,6 +641,37 @@ def test_up_mode_simple( mock_create_devservices_network.assert_called_once() + mock_subprocess_check_output.assert_has_calls( + [ + mock.call( + [ + "docker", + "compose", + "-f", + f"{service_path}/{DEVSERVICES_DIR_NAME}/{CONFIG_FILE_NAME}", + "config", + "--services", + ], + text=True, + env=mock.ANY, + ), + mock.call( + [ + "docker", + "compose", + "-p", + "example-service", + "-f", + f"{service_path}/{DEVSERVICES_DIR_NAME}/{CONFIG_FILE_NAME}", + "ps", + "--format", + "{{.Name}}", + ], + text=True, + ), + ] + ) + mock_run.assert_called_with( [ "docker",