Skip to content

Commit

Permalink
Merge 99eac77 into 05158fb
Browse files Browse the repository at this point in the history
  • Loading branch information
itsthejoker committed Jan 27, 2022
2 parents 05158fb + 99eac77 commit eff498f
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 4 deletions.
25 changes: 25 additions & 0 deletions api/tests/submissions/test_submission_done.py
Original file line number Diff line number Diff line change
Expand Up @@ -262,6 +262,11 @@ def test_send_transcription_to_slack(
f"Please check the following transcription of u/{user.username}:"
f" asdf."
)
check_slack_message = (
f"Please check the following transcription of u/{user.username}:"
f" asdf.\n\nThis user is being watched with a chance of 100%.\n"
f"Undo this using the `unwatch {user.username}` command."
)

assert result.status_code == status.HTTP_201_CREATED
assert (
Expand Down Expand Up @@ -291,6 +296,26 @@ def test_send_transcription_to_slack(
)
== slack_client.chat_postMessage.call_args_list[-1]
)
submission.refresh_from_db()
submission.completed_by = None
submission.save()

user.overwrite_check_percentage = 1
user.save()
result = client.patch(
reverse("submission-done", args=[submission.id]),
json.dumps({"username": user.username}),
content_type="application/json",
**headers,
)
assert result.status_code == status.HTTP_201_CREATED
assert (
call(
channel=settings.SLACK_TRANSCRIPTION_CHECK_CHANNEL,
text=check_slack_message,
)
== slack_client.chat_postMessage.call_args_list[-1]
)

def test_removed_transcription_changes(self, client: Client) -> None:
"""Verify that a removed transcription is not sent to Slack."""
Expand Down
4 changes: 4 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -76,3 +76,7 @@ exclude = '''
requires = ["poetry>=0.12"]
build-backend = "poetry.masonry.api"

[tool.pytest.ini_options]
DJANGO_SETTINGS_MODULE = "blossom.settings.testing"
python_files = "tests.py test_*.py *_tests.py"
addopts = "--nomigrations --cov=. --cov-report=html --cov-report=term:skip-covered -p no:warnings"
4 changes: 0 additions & 4 deletions pytest.ini

This file was deleted.

0 comments on commit eff498f

Please sign in to comment.