Skip to content

Commit

Permalink
Add test case
Browse files Browse the repository at this point in the history
  • Loading branch information
gagantrivedi committed Dec 7, 2023
1 parent 6ac8156 commit 85cf09b
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions api/tests/unit/sse/test_tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,10 @@
send_environment_update_message_for_project,
update_sse_usage,
)
from task_processor.management.commands.runprocessor import (
Command as RunProcessorCommand,
)
from task_processor.models import RecurringTask


def test_send_environment_update_message_for_project_make_correct_request(
Expand Down Expand Up @@ -138,3 +142,21 @@ def test_track_sse_usage(
bucket=influxdb_bucket,
record=mocked_influx_point().field().tag().tag().tag().time(),
)


@pytest.mark.django_db
def test_track_sse_usage_is_installed_correctly(settings: SettingsWrapper):
# Given
settings.AWS_SSE_LOGS_BUCKET_NAME = "test_bucket"

# When
# Initialising the command should save the task to the database
RunProcessorCommand()

# Then
assert (
RecurringTask.objects.filter(
task_identifier=f"tasks.{update_sse_usage.__name__}"
).exists()
is True
)

0 comments on commit 85cf09b

Please sign in to comment.