Skip to content

Commit

Permalink
test: ✅ Add 'login' and 'register' fixtures in conftest.py
Browse files Browse the repository at this point in the history
  • Loading branch information
rafaVls committed Aug 21, 2021
1 parent b33b83f commit 26b0b4f
Showing 1 changed file with 28 additions and 1 deletion.
29 changes: 28 additions & 1 deletion src/tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,4 +61,31 @@ def test_client(flask_app):
with flask_app.test_client() as testing_client:
# Establish an application context
with flask_app.app_context():
yield testing_client # this is where the testing happens
yield testing_client # this is where the testing happens

@pytest.fixture()
def register_response(test_client, user_info={"username": "a", "password": "a", "country": "a"}):
response = test_client.post(
"/auth/register",
data={
"username": user_info["username"],
"password": user_info["password"],
"country": user_info["country"]
},
follow_redirects=True
)

return response

@pytest.fixture()
def login_response(test_client, user_info={"username": "test", "password": "test"}):
response = test_client.post(
"/auth/login",
data={
"username": user_info["username"],
"password": user_info["password"]
},
follow_redirects=True
)

return response

0 comments on commit 26b0b4f

Please sign in to comment.