diff --git a/.github/workflows/django.yml b/.github/workflows/django.yml index 084c16bff..0a9ad82ed 100644 --- a/.github/workflows/django.yml +++ b/.github/workflows/django.yml @@ -60,4 +60,3 @@ jobs: py.test --cov env: POSTGRES_PASSWORD: postgres - diff --git a/tests/applications/models/test_applications.py b/tests/applications/models/test_applications.py index 92a86ba55..7fb0ecc03 100644 --- a/tests/applications/models/test_applications.py +++ b/tests/applications/models/test_applications.py @@ -80,3 +80,9 @@ def test_is_scored_by_user(application, user, another_user): Score.objects.create(user=another_user, application=application, score=0) assert application.is_scored_by_user(another_user) is False + + +def test_score_str(application, user, another_user): + score = Score.objects.create(user=user, application=application, score=3) + + assert str(score) == f"{score.user} - {score.application}. Score {score.score}" diff --git a/tests/applications/views/test_applications.py b/tests/applications/views/test_applications.py index 0acaa7e81..c5ec78665 100644 --- a/tests/applications/views/test_applications.py +++ b/tests/applications/views/test_applications.py @@ -13,7 +13,7 @@ def test_access_applications_view(client, user_client, admin_client, future_even resp = client.get(applications_url) assert resp.status_code == 302 - # as logged in user, but not orgarniser of given event + # as logged in user, but not organiser of given event resp = user_client.get(applications_url) assert resp.status_code == 404 @@ -125,6 +125,10 @@ def get_filtered_applications_list( assert resp.context["applications"] == [application_waitlisted] +def test_application_str(admin_client, future_event, application_submitted): + assert str(application_submitted.id) == str(application_submitted) + + def test_changing_application_status(admin_client, future_event, application_submitted): assert application_submitted.state == "submitted" resp = admin_client.post( diff --git a/tests/applications/views/test_applications_download.py b/tests/applications/views/test_applications_download.py index ce4223ab8..aace8be84 100644 --- a/tests/applications/views/test_applications_download.py +++ b/tests/applications/views/test_applications_download.py @@ -74,3 +74,13 @@ def test_download_applications_list_with_question_added( # column assert csv_list[5][17] == "answer to last for app 5" assert csv_list[5][18] == "answer to questionx for app 5" + + +def test_answer_str(admin_client, application_submitted, future_event, future_event_form, applications): + last_question = future_event_form.question_set.last() + + new_application = Application.objects.create(form=future_event_form, state="submitted") + answer = Answer.objects.create( + application=new_application, question=last_question, answer="answer to last for app 5" + ) + assert str(answer) == f"{answer.application} - {answer.question}" diff --git a/tests/core/test_admin.py b/tests/core/test_admin.py index 889605fe4..f535714d2 100644 --- a/tests/core/test_admin.py +++ b/tests/core/test_admin.py @@ -163,3 +163,8 @@ def test_unfreeze_events_action(admin_client, future_event): assert response.status_code == 200 assert Event.objects.filter(is_frozen=False).count() == 1 assert Event.objects.filter(is_on_homepage=True).count() == 1 + + +def test_event_str(admin_client, events): + event = events[0] + assert str(event) == f"{event.name}, {event.date}"