diff options
| author | stilbruch <stilbruch@protonmail.com> | 2022-05-06 14:19:14 -0500 |
|---|---|---|
| committer | stilbruch <stilbruch@protonmail.com> | 2022-05-06 14:19:14 -0500 |
| commit | 970277e71272687c16d75ffa73fcbb461a1fee80 (patch) | |
| tree | e3e47dda5edbb36fbd737068bd908936f395f328 /app | |
| parent | c573605ac77b82068de0961a0309cdf07e4d7b65 (diff) | |
| download | Strengthy-970277e71272687c16d75ffa73fcbb461a1fee80.tar.xz Strengthy-970277e71272687c16d75ffa73fcbb461a1fee80.zip | |
Add a few more tests and update project outline
Diffstat (limited to 'app')
| -rw-r--r-- | app/tests/conftest.py | 6 | ||||
| -rw-r--r-- | app/tests/test_routes.py | 24 | ||||
| -rw-r--r-- | app/tests/test_tables.py | 2 |
3 files changed, 31 insertions, 1 deletions
diff --git a/app/tests/conftest.py b/app/tests/conftest.py index e13f987..849b5c5 100644 --- a/app/tests/conftest.py +++ b/app/tests/conftest.py @@ -4,6 +4,12 @@ from app import app from tables import User +@pytest.fixture +def client(): + with app.test_client() as client: + yield client + + @pytest.fixture(scope="module") def new_user(): user = User("gymdude99", "bench400soon!", "gymdude99@gmail.com") diff --git a/app/tests/test_routes.py b/app/tests/test_routes.py new file mode 100644 index 0000000..c03238e --- /dev/null +++ b/app/tests/test_routes.py @@ -0,0 +1,24 @@ +import pytest + +from app import app + + +def test_index(client): + resp = client.get("/") + + assert b"Welcome to Strengthy" in resp.data + + +# horrible name +def test_workout_create_notloggedin(client): + resp = client.get("/workout/create", follow_redirects=True) + + # Make sure redirect worked + assert resp.request.path == "/login" + + +def test_home_notloggedin(client): + resp = client.get("/home", follow_redirects=True) + + # Make sure redirect worked + assert resp.request.path == "/login" diff --git a/app/tests/test_tables.py b/app/tests/test_tables.py index bb6e617..ba7ac10 100644 --- a/app/tests/test_tables.py +++ b/app/tests/test_tables.py @@ -17,7 +17,7 @@ def test_new_workout(): """ GIVEN a Workout model WHEN a new Workout is created - THEN check that the email, hashed_password, and role fields are defined correctly + THEN check that the user_id, name, and exercises fields are defined correctly """ # TODO other way to generate new user? |
