From e0a86eafbcfb276d591757831532e45dabacedb7 Mon Sep 17 00:00:00 2001 From: devan Date: Thu, 13 Feb 2025 19:53:14 -0800 Subject: [PATCH] Fixed Unit test cases --- tests/test_auth.py | 4 ++-- tests/test_blog.py | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/tests/test_auth.py b/tests/test_auth.py index 3ac9a12..dd25dde 100644 --- a/tests/test_auth.py +++ b/tests/test_auth.py @@ -11,7 +11,7 @@ def test_register(client, app): # test that successful registration redirects to the login page response = client.post("/auth/register", data={"username": "a", "password": "a"}) - assert "http://localhost/auth/login" == response.headers["Location"] + assert "/auth/login" == response.headers["Location"] # test that the user was inserted into the database with app.app_context(): @@ -42,7 +42,7 @@ def test_login(client, auth): # test that successful login redirects to the index page response = auth.login() - assert response.headers["Location"] == "http://localhost/" + assert response.headers["Location"] == "/" # login request set the user_id in the session # check that the user is loaded from the session diff --git a/tests/test_blog.py b/tests/test_blog.py index 9185968..55c769d 100644 --- a/tests/test_blog.py +++ b/tests/test_blog.py @@ -19,7 +19,7 @@ def test_index(client, auth): @pytest.mark.parametrize("path", ("/create", "/1/update", "/1/delete")) def test_login_required(client, path): response = client.post(path) - assert response.headers["Location"] == "http://localhost/auth/login" + assert response.headers["Location"] == "/auth/login" def test_author_required(app, client, auth): @@ -75,7 +75,7 @@ def test_create_update_validate(client, auth, path): def test_delete(client, auth, app): auth.login() response = client.post("/1/delete") - assert response.headers["Location"] == "http://localhost/" + assert response.headers["Location"] == "/" with app.app_context(): db = get_db()