From 9310c63a1e8c9aa74b42fd26d67e585a8090361a Mon Sep 17 00:00:00 2001 From: --global Date: Sun, 26 May 2024 12:47:19 -0400 Subject: [PATCH] fix tests' --- app/config.py | 3 +++ tests/conftest.py | 3 ++- tests/test_site.py | 1 - 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/app/config.py b/app/config.py index c335e70..e6c536d 100644 --- a/app/config.py +++ b/app/config.py @@ -261,6 +261,7 @@ class TestingConfig(Config): """ ENV: str = "testing" + PREFERRED_URL_SCHEME: str = "https" SEND_TWEETS: bool = True # Won't actually send tweets. TESTING: bool = True CACHE_TYPE: str = "flask_caching.backends.simple" @@ -269,6 +270,8 @@ class TestingConfig(Config): POSTGRES_DB: str = os.getenv("POSTGRES_DB", "flagging") + "_test" MAIL_USERNAME = "admin@admin.com" MAIL_ERROR_ALERTS_TO = "some@email.com" + BASIC_AUTH_USERNAME: str = "admin" + BASIC_AUTH_PASSWORD: str = "password" class DemoConfig(ProductionConfig): diff --git a/tests/conftest.py b/tests/conftest.py index 8b4e68e..89cece4 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -2,6 +2,7 @@ import pytest from flask import g +from flask.testing import FlaskClient from pytest_postgresql.janitor import DatabaseJanitor from app.data.database import init_db @@ -46,7 +47,7 @@ def live_app(app): @pytest.fixture(scope="function") -def client(app): +def client(app) -> FlaskClient: """A test client for the app. You can think of the test like a web browser; it retrieves data from the website in a similar way that a browser would. """ diff --git a/tests/test_site.py b/tests/test_site.py index e8e7220..252a76b 100644 --- a/tests/test_site.py +++ b/tests/test_site.py @@ -64,7 +64,6 @@ def test_pages(client, page, expected_status_code): def test_admin_pages(client, page, auth, expected_status_code): headers = auth_to_header(auth) res = client.get(page, headers=headers) - assert res.status_code == expected_status_code