Skip to content

Commit

Permalink
test: fix test result finisher tests
Browse files Browse the repository at this point in the history
Signed-off-by: joseph-sentry <[email protected]>
  • Loading branch information
joseph-sentry committed Apr 2, 2024
1 parent 6697e9c commit 17d9a0e
Showing 1 changed file with 26 additions and 6 deletions.
32 changes: 26 additions & 6 deletions tasks/tests/unit/test_test_results_finisher.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
from database.tests.factories import CommitFactory, PullFactory, UploadFactory
from services.repository import EnrichedPull
from services.test_results import generate_test_id
from tasks.test_results_finisher import TestResultsFinisherTask
from tasks.test_results_finisher import QUEUE_NOTIFY_KEY, TestResultsFinisherTask

here = Path(__file__)

Expand Down Expand Up @@ -219,7 +219,11 @@ def test_upload_finisher_task_call(
commit_yaml={"codecov": {"max_report_age": False}},
)

expected_result = {"notify_attempted": True, "notify_succeeded": True}
expected_result = {
"notify_attempted": True,
"notify_succeeded": True,
QUEUE_NOTIFY_KEY: False,
}

assert expected_result == result
mock_repo_provider_comments.post_comment.assert_called_with(
Expand Down Expand Up @@ -277,7 +281,11 @@ def test_upload_finisher_task_call_no_failures(
commit_yaml={"codecov": {"max_report_age": False}},
)

expected_result = {"notify_attempted": False, "notify_succeeded": False}
expected_result = {
"notify_attempted": False,
"notify_succeeded": False,
QUEUE_NOTIFY_KEY: True,
}
test_results_mock_app.tasks[
"app.tasks.notify.Notify"
].apply_async.assert_called_with(
Expand Down Expand Up @@ -335,7 +343,11 @@ def test_upload_finisher_task_call_no_success(
commit_yaml={"codecov": {"max_report_age": False}},
)

expected_result = {"notify_attempted": False, "notify_succeeded": False}
expected_result = {
"notify_attempted": False,
"notify_succeeded": False,
QUEUE_NOTIFY_KEY: False,
}

assert expected_result == result

Expand Down Expand Up @@ -379,7 +391,11 @@ def test_upload_finisher_task_call_existing_comment(
commit_yaml={"codecov": {"max_report_age": False}},
)

expected_result = {"notify_attempted": True, "notify_succeeded": True}
expected_result = {
"notify_attempted": True,
"notify_succeeded": True,
QUEUE_NOTIFY_KEY: False,
}

mock_repo_provider_comments.edit_comment.assert_called_with(
pull.pullid,
Expand Down Expand Up @@ -418,7 +434,11 @@ def test_upload_finisher_task_call_comment_fails(
commit_yaml={"codecov": {"max_report_age": False}},
)

expected_result = {"notify_attempted": True, "notify_succeeded": False}
expected_result = {
"notify_attempted": True,
"notify_succeeded": False,
QUEUE_NOTIFY_KEY: False,
}

assert expected_result == result

Expand Down

0 comments on commit 17d9a0e

Please sign in to comment.