From 37db0e092335b5fad485f6c7f44d1c2b79b7707a Mon Sep 17 00:00:00 2001 From: Kim Gustyr Date: Fri, 20 Sep 2024 22:53:53 +0100 Subject: [PATCH] fix: Webhook integration not rebuilding environment (#4641) --- api/integrations/webhook/models.py | 2 +- .../webhook/test_unit_webhook_models.py | 19 +++++++++++++++++++ 2 files changed, 20 insertions(+), 1 deletion(-) create mode 100644 api/tests/unit/integrations/webhook/test_unit_webhook_models.py diff --git a/api/integrations/webhook/models.py b/api/integrations/webhook/models.py index 7741aa215e6e..ab2a8cb7590b 100644 --- a/api/integrations/webhook/models.py +++ b/api/integrations/webhook/models.py @@ -11,7 +11,7 @@ class WebhookConfiguration( - AbstractBaseSoftDeleteExportableWebhookModel, LifecycleModelMixin + LifecycleModelMixin, AbstractBaseSoftDeleteExportableWebhookModel ): environment = models.OneToOneField( Environment, related_name="webhook_config", on_delete=models.CASCADE diff --git a/api/tests/unit/integrations/webhook/test_unit_webhook_models.py b/api/tests/unit/integrations/webhook/test_unit_webhook_models.py new file mode 100644 index 000000000000..51ac8192646c --- /dev/null +++ b/api/tests/unit/integrations/webhook/test_unit_webhook_models.py @@ -0,0 +1,19 @@ +from pytest_mock import MockerFixture + +from environments.models import Environment +from integrations.webhook.models import WebhookConfiguration + + +def test_webhook_model__save__call_expected( + environment: Environment, mocker: MockerFixture +) -> None: + # Given + environment_mock = mocker.patch("integrations.webhook.models.Environment") + + # When + WebhookConfiguration.objects.create(environment=environment) + + # Then + environment_mock.write_environments_to_dynamodb.assert_called_with( + environment_id=environment.id + )