Skip to content

Commit

Permalink
Change name of test_common to test_basic - PyCharm breakpoints didn't…
Browse files Browse the repository at this point in the history
… work? (#920)
  • Loading branch information
jwag956 authored Feb 14, 2024
1 parent 266e648 commit bfe1deb
Showing 1 changed file with 22 additions and 22 deletions.
44 changes: 22 additions & 22 deletions tests/test_common.py → tests/test_basic.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
"""
test_common
test_basic
~~~~~~~~~~~
Test common functionality
Expand Down Expand Up @@ -972,16 +972,16 @@ def test_verifying_token_from_version_3x(in_app_context):
than token from version 4.0.0, can be verified
"""

app = in_app_context
populate_data(app)
myapp = in_app_context
populate_data(myapp)

with app.test_request_context("/"):
user = app.security.datastore.find_user(email="matt@lp.com")
with myapp.test_request_context("/"):
user = myapp.security.datastore.find_user(email="matt@lp.com")

token = get_auth_token_version_3x(app, user)
token = get_auth_token_version_3x(myapp, user)

data = app.security.remember_token_serializer.loads(
token, max_age=app.config["SECURITY_TOKEN_MAX_AGE"]
data = myapp.security.remember_token_serializer.loads(
token, max_age=myapp.config["SECURITY_TOKEN_MAX_AGE"]
)

assert user.verify_auth_token(data) is True
Expand Down Expand Up @@ -1109,20 +1109,20 @@ def test_session_query(in_app_context):
# This is since the session will load one - but auth_token_required needs to
# verify that the TOKEN is valid (and it is possible that the user_id in the
# session is different that the one in the token (huh?)
app = in_app_context
populate_data(app)
client = app.test_client()
myapp = in_app_context
populate_data(myapp)
myclient = myapp.test_client()

response = json_authenticate(client)
response = json_authenticate(myclient)
token = response.json["response"]["user"]["authentication_token"]
current_nqueries = get_num_queries(app.security.datastore)
current_nqueries = get_num_queries(myapp.security.datastore)

response = client.get(
response = myclient.get(
"/token",
headers={"Content-Type": "application/json", "Authentication-Token": token},
)
assert response.status_code == 200
end_nqueries = get_num_queries(app.security.datastore)
end_nqueries = get_num_queries(myapp.security.datastore)
assert current_nqueries is None or end_nqueries == (current_nqueries + 2)


Expand Down Expand Up @@ -1155,15 +1155,15 @@ def test_auth_token_decorator(in_app_context):
when using token generated by flask security 3.x algorithm
"""

app = in_app_context
populate_data(app)
client_nc = app.test_client(use_cookies=False)
myapp = in_app_context
populate_data(myapp)
myclient_nc = myapp.test_client(use_cookies=False)

with app.test_request_context("/"):
user = app.security.datastore.find_user(email="matt@lp.com")
token = get_auth_token_version_3x(app, user)
with myapp.test_request_context("/"):
user = myapp.security.datastore.find_user(email="matt@lp.com")
token = get_auth_token_version_3x(myapp, user)

response = client_nc.get(
response = myclient_nc.get(
"/token",
headers={"Content-Type": "application/json", "Authentication-Token": token},
)
Expand Down

0 comments on commit bfe1deb

Please sign in to comment.