Skip to content

Commit

Permalink
Fix remaining tests
Browse files Browse the repository at this point in the history
  • Loading branch information
matthewelwell committed Nov 29, 2024
1 parent 1734cf5 commit 68a05de
Showing 1 changed file with 12 additions and 10 deletions.
22 changes: 12 additions & 10 deletions api/tests/unit/audit/test_unit_audit_signals.py
Original file line number Diff line number Diff line change
Expand Up @@ -108,15 +108,16 @@ 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,
)
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)

Expand All @@ -139,17 +140,18 @@ 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,
)
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)

Expand Down Expand Up @@ -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,
Expand All @@ -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)

Expand Down

0 comments on commit 68a05de

Please sign in to comment.