diff --git a/api/tests/unit/audit/test_unit_audit_signals.py b/api/tests/unit/audit/test_unit_audit_signals.py index 78dd9d818717..056dfd5c8c7c 100644 --- a/api/tests/unit/audit/test_unit_audit_signals.py +++ b/api/tests/unit/audit/test_unit_audit_signals.py @@ -108,8 +108,6 @@ def test_send_audit_log_event_to_grafana__project_grafana_config__calls_expected project: Project, ) -> None: # Given - grafana_config = GrafanaProjectConfiguration(base_url="test.com", api_key="test") - project.grafana_config = grafana_config audit_log_record = AuditLog.objects.create( project=project, related_object_type=RelatedObjectType.FEATURE.name, @@ -117,6 +115,9 @@ def test_send_audit_log_event_to_grafana__project_grafana_config__calls_expected grafana_wrapper_mock = mocker.patch("audit.signals.GrafanaWrapper", autospec=True) grafana_wrapper_instance_mock = grafana_wrapper_mock.return_value + grafana_config = GrafanaProjectConfiguration(base_url="test.com", api_key="test") + project.grafana_config = grafana_config + # When send_audit_log_event_to_grafana(AuditLog, audit_log_record) @@ -139,10 +140,6 @@ def test_send_audit_log_event_to_grafana__organisation_grafana_config__calls_exp project: Project, ) -> None: # Given - grafana_config = GrafanaOrganisationConfiguration( - base_url="test.com", api_key="test" - ) - organisation.grafana_config = grafana_config audit_log_record = AuditLog.objects.create( project=project, related_object_type=RelatedObjectType.FEATURE.name, @@ -150,6 +147,11 @@ def test_send_audit_log_event_to_grafana__organisation_grafana_config__calls_exp grafana_wrapper_mock = mocker.patch("audit.signals.GrafanaWrapper", autospec=True) grafana_wrapper_instance_mock = grafana_wrapper_mock.return_value + grafana_config = GrafanaOrganisationConfiguration( + base_url="test.com", api_key="test" + ) + organisation.grafana_config = grafana_config + # When send_audit_log_event_to_grafana(AuditLog, audit_log_record) @@ -228,10 +230,6 @@ def test_send_audit_log_event_to_dynatrace__environment_dynatrace_config__calls_ environment: Environment, ) -> None: # Given - dynatrace_config = DynatraceConfiguration.objects.create( - base_url="http://test.com", api_key="api_123", environment=environment - ) - environment.refresh_from_db() audit_log_record = AuditLog.objects.create( environment=environment, related_object_type=RelatedObjectType.FEATURE.name, @@ -241,6 +239,10 @@ def test_send_audit_log_event_to_dynatrace__environment_dynatrace_config__calls_ ) dynatrace_wrapper_instance_mock = dynatrace_wrapper_mock.return_value + dynatrace_config = DynatraceConfiguration.objects.create( + base_url="http://test.com", api_key="api_123", environment=environment + ) + # When send_audit_log_event_to_dynatrace(AuditLog, audit_log_record)