diff --git a/pytest.ini b/pytest.ini new file mode 100644 index 000000000..c24fe5bb9 --- /dev/null +++ b/pytest.ini @@ -0,0 +1,3 @@ +[pytest] +filterwarnings = + ignore::DeprecationWarning diff --git a/tests/test_show_summary.py b/tests/test_show_summary.py new file mode 100644 index 000000000..a82510519 --- /dev/null +++ b/tests/test_show_summary.py @@ -0,0 +1,16 @@ +import pytest + +def test_welcome_page_when_loading_accepted(client, setup_data): + """TEST: The welcome page should load when credentials are correct""" + response = client.post('/show_summary', data={'email': 'clubA@example.com'}) + + assert response.status_code == 200 + assert b"Welcome" in response.data + assert b"Competition 1" in response.data + +def test_error_when_wrong_credentials(client, setup_data): + """TEST: Wrong credentials should redirect to index with an error message""" + response = client.post('/show_summary', data={'email': 'fake@example.com'}, follow_redirects=True) + + assert response.status_code == 200 + assert b"Wrong credentials, please retry" in response.data