Skip to content

Commit 159170f

Browse files
committed
fixes tests
1 parent 4235dd9 commit 159170f

File tree

3 files changed

+9
-8
lines changed

3 files changed

+9
-8
lines changed

supertokens_python/recipe/session/session_class.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@
3636
)
3737
from .constants import protected_props
3838
from ...framework import BaseRequest
39-
from supertokens_python.utils import log_debug_message, default_user_context
39+
from supertokens_python.utils import log_debug_message
4040

4141
_T = TypeVar("_T")
4242

@@ -51,8 +51,6 @@ async def attach_to_request_response(
5151
self.req_res_info = ReqResInfo(request, transfer_method)
5252

5353
if self.access_token_updated:
54-
if user_context is None:
55-
user_context = default_user_context(request)
5654
self.response_mutators.append(
5755
access_token_mutator(
5856
self.access_token,

tests/emailpassword/test_passwordreset.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -430,7 +430,7 @@ async def send_email(
430430
supertokens_config=SupertokensConfig("http://localhost:3567"),
431431
app_info=InputAppInfo(
432432
app_name="SuperTokens Demo",
433-
api_domain="http://api.supertokens.io",
433+
api_domain="localhost:3001",
434434
origin=get_origin,
435435
api_base_path="/auth",
436436
),

tests/test_user_context.py

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -426,20 +426,23 @@ async def create_new_session(
426426
)
427427

428428

429+
@mark.asyncio
429430
async def test_default_user_context_func_calls():
430431
# Tests run in the root directory of the repo
431432
root_dir = Path("supertokens_python")
432433
file_occurences: List[str] = []
433434
for path in root_dir.rglob("*.py"):
434435
with open(path) as f:
436+
lines = f.readlines()
435437
file_occurences.extend(
436438
[str(path)]
437-
* f.read().count(
438-
"user_context = set_request_in_user_context_if_not_defined("
439+
* sum(
440+
"set_request_in_user_context_if_not_defined(" in line
441+
for line in lines
439442
)
440443
)
441444
file_occurences.extend(
442-
[str(path)] * f.read().count("user_context = default_user_context(")
445+
[str(path)] * sum("default_user_context(" in line for line in lines)
443446
)
444447

445-
assert len(file_occurences) == 7
448+
assert len(file_occurences) == 18

0 commit comments

Comments
 (0)