From 42f33527c51effce8ad39e8b7d7f94a6a642d736 Mon Sep 17 00:00:00 2001 From: Bruno Alla Date: Sun, 24 Jan 2021 15:11:15 +0000 Subject: [PATCH] Refactor test --- .../users/tests/test_views.py | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/{{cookiecutter.project_slug}}/{{cookiecutter.project_slug}}/users/tests/test_views.py b/{{cookiecutter.project_slug}}/{{cookiecutter.project_slug}}/users/tests/test_views.py index 52d14606..c2fe8b51 100644 --- a/{{cookiecutter.project_slug}}/{{cookiecutter.project_slug}}/users/tests/test_views.py +++ b/{{cookiecutter.project_slug}}/{{cookiecutter.project_slug}}/users/tests/test_views.py @@ -61,11 +61,8 @@ class TestUserUpdateView: form.cleaned_data = [] view.form_valid(form) - found_message = False - for message in messages.get_messages(request): - assert message.message == "Information successfully updated" - found_message = True - assert found_message + messages_sent = [m.message for m in messages.get_messages(request)] + assert messages_sent == ["Information successfully updated"] class TestUserRedirectView: