def test_error_checking_ecs_service_is_not_deploying(aws_client): client = MagicMock() client.describe_services = MagicMock(return_value={ 'services': [], 'failures': [{ 'reason': 'some_reason', 'arn': 'some_arn' }] }) aws_client.return_value = client cluster = "ecs-cluster" service = "ecs-service" with pytest.raises(FailedActivity) as exceptionInfo: service_is_deploying(cluster, service) client.describe_services.assert_called_with(cluster=cluster, services=[service]) assert 'Error retrieving service data from AWS' in str(exceptionInfo.value)
def test_ecs_service_is_not_deploying(aws_client): client = MagicMock() client.describe_services = MagicMock( return_value={'services': [{ 'deployments': [{ "status": "PRIMARY" }] }]}) aws_client.return_value = client cluster = "ecs-cluster" service = "ecs-service" response = service_is_deploying(cluster, service) client.describe_services.assert_called_with(cluster=cluster, services=[service]) assert response is False