Skip to content

Commit dc8c897

Browse files
committed
fixes linting and formatting in tests
1 parent ca26b7c commit dc8c897

File tree

5 files changed

+22
-33
lines changed

5 files changed

+22
-33
lines changed

.pylintrc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ limit-inference-results=100
4545

4646
# List of plugins (as comma separated values of python module names) to load,
4747
# usually to register additional checkers.
48-
load-plugins=pylint.extensions.no_self_use
48+
load-plugins=
4949

5050
# Pickle collected data for later comparisons.
5151
persistent=yes

.vscode/settings.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
{
2+
"python.linting.pylintEnabled": true,
3+
"python.linting.enabled": true,
24
"editor.codeActionsOnSave": {
35
"source.organizeImports": true
46
},

supertokens_python/recipe/session/utils.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -377,6 +377,7 @@ def validate_and_normalise_user_input(
377377
use_dynamic_access_token_signing_key: Union[bool, None] = None,
378378
expose_access_token_to_frontend_in_cookie_based_auth: Union[bool, None] = None,
379379
):
380+
_ = cookie_same_site # we have this otherwise pylint complains that cookie_same_site is unused, but it is being used in the get_cookie_same_site function.
380381
if anti_csrf not in {"VIA_TOKEN", "VIA_CUSTOM_HEADER", "NONE", None}:
381382
raise ValueError(
382383
"anti_csrf must be one of VIA_TOKEN, VIA_CUSTOM_HEADER, NONE or None"

tests/test_config.py

Lines changed: 17 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -266,7 +266,7 @@ async def test_same_site_values():
266266
recipe_list=[session.init(cookie_same_site="lax")],
267267
)
268268

269-
assert SessionRecipe.get_instance().config.get_cookie_same_site(None, None) == "lax"
269+
assert SessionRecipe.get_instance().config.get_cookie_same_site(None, {}) == "lax"
270270

271271
reset()
272272

@@ -281,9 +281,7 @@ async def test_same_site_values():
281281
recipe_list=[session.init(cookie_same_site="none")],
282282
)
283283

284-
assert (
285-
SessionRecipe.get_instance().config.get_cookie_same_site(None, None) == "none"
286-
)
284+
assert SessionRecipe.get_instance().config.get_cookie_same_site(None, {}) == "none"
287285

288286
reset()
289287

@@ -299,7 +297,7 @@ async def test_same_site_values():
299297
)
300298

301299
assert (
302-
SessionRecipe.get_instance().config.get_cookie_same_site(None, None) == "strict"
300+
SessionRecipe.get_instance().config.get_cookie_same_site(None, {}) == "strict"
303301
)
304302

305303
reset()
@@ -355,7 +353,7 @@ async def test_same_site_values():
355353
],
356354
)
357355

358-
assert SessionRecipe.get_instance().config.get_cookie_same_site(None, None) == "lax"
356+
assert SessionRecipe.get_instance().config.get_cookie_same_site(None, {}) == "lax"
359357

360358
reset()
361359

@@ -372,9 +370,7 @@ async def test_same_site_values():
372370
],
373371
)
374372

375-
assert (
376-
SessionRecipe.get_instance().config.get_cookie_same_site(None, None) == "none"
377-
)
373+
assert SessionRecipe.get_instance().config.get_cookie_same_site(None, {}) == "none"
378374

379375
reset()
380376

@@ -395,7 +391,7 @@ async def test_config_values():
395391
recipe_list=[session.init(anti_csrf="VIA_CUSTOM_HEADER")],
396392
)
397393

398-
assert SessionRecipe.get_instance().config.get_cookie_same_site(None, None) == "lax"
394+
assert SessionRecipe.get_instance().config.get_cookie_same_site(None, {}) == "lax"
399395
assert (
400396
SessionRecipe.get_instance().config.anti_csrf_function_or_string
401397
== "VIA_CUSTOM_HEADER"
@@ -419,7 +415,7 @@ async def test_config_values():
419415
],
420416
)
421417

422-
assert SessionRecipe.get_instance().config.get_cookie_same_site(None, None) == "lax"
418+
assert SessionRecipe.get_instance().config.get_cookie_same_site(None, {}) == "lax"
423419
assert SessionRecipe.get_instance().config.anti_csrf_function_or_string == "NONE"
424420
assert SessionRecipe.get_instance().config.cookie_secure
425421

@@ -440,9 +436,7 @@ async def test_config_values():
440436
],
441437
)
442438

443-
assert (
444-
SessionRecipe.get_instance().config.get_cookie_same_site(None, None) == "none"
445-
)
439+
assert SessionRecipe.get_instance().config.get_cookie_same_site(None, {}) == "none"
446440
assert (
447441
SessionRecipe.get_instance().config.anti_csrf_function_or_string
448442
== "VIA_CUSTOM_HEADER"
@@ -466,7 +460,7 @@ async def test_config_values():
466460
],
467461
)
468462

469-
assert SessionRecipe.get_instance().config.get_cookie_same_site(None, None) == "lax"
463+
assert SessionRecipe.get_instance().config.get_cookie_same_site(None, {}) == "lax"
470464
assert SessionRecipe.get_instance().config.anti_csrf_function_or_string == "NONE"
471465
assert SessionRecipe.get_instance().config.cookie_secure
472466

@@ -487,7 +481,7 @@ async def test_config_values():
487481
],
488482
)
489483

490-
assert SessionRecipe.get_instance().config.get_cookie_same_site(None, None) == "lax"
484+
assert SessionRecipe.get_instance().config.get_cookie_same_site(None, {}) == "lax"
491485
assert SessionRecipe.get_instance().config.anti_csrf_function_or_string == "NONE"
492486
assert not SessionRecipe.get_instance().config.cookie_secure
493487

@@ -506,7 +500,7 @@ async def test_config_values():
506500
recipe_list=[session.init(anti_csrf="VIA_CUSTOM_HEADER")],
507501
)
508502

509-
assert SessionRecipe.get_instance().config.get_cookie_same_site(None, None) == "lax"
503+
assert SessionRecipe.get_instance().config.get_cookie_same_site(None, {}) == "lax"
510504
assert (
511505
SessionRecipe.get_instance().config.anti_csrf_function_or_string
512506
== "VIA_CUSTOM_HEADER"
@@ -530,9 +524,7 @@ async def test_config_values():
530524
],
531525
)
532526

533-
assert (
534-
SessionRecipe.get_instance().config.get_cookie_same_site(None, None) == "none"
535-
)
527+
assert SessionRecipe.get_instance().config.get_cookie_same_site(None, {}) == "none"
536528
assert (
537529
SessionRecipe.get_instance().config.anti_csrf_function_or_string
538530
== "VIA_CUSTOM_HEADER"
@@ -556,7 +548,7 @@ async def test_config_values():
556548
],
557549
)
558550

559-
assert SessionRecipe.get_instance().config.get_cookie_same_site(None, None) == "lax"
551+
assert SessionRecipe.get_instance().config.get_cookie_same_site(None, {}) == "lax"
560552
assert SessionRecipe.get_instance().config.anti_csrf_function_or_string == "NONE"
561553
assert not SessionRecipe.get_instance().config.cookie_secure
562554

@@ -577,9 +569,7 @@ async def test_config_values():
577569
],
578570
)
579571

580-
assert (
581-
SessionRecipe.get_instance().config.get_cookie_same_site(None, None) == "none"
582-
)
572+
assert SessionRecipe.get_instance().config.get_cookie_same_site(None, {}) == "none"
583573
assert SessionRecipe.get_instance().config.cookie_secure
584574

585575
reset()
@@ -782,9 +772,7 @@ async def test_cookie_samesite_with_ec2_public_url():
782772
# domain name isn't provided so browser decides to use the same host
783773
# which will be ec2-xx-yyy-zzz-0.compute-1.amazonaws.com
784774
assert SessionRecipe.get_instance().config.cookie_domain is None
785-
assert (
786-
SessionRecipe.get_instance().config.get_cookie_same_site(None, None) == "none"
787-
)
775+
assert SessionRecipe.get_instance().config.get_cookie_same_site(None, {}) == "none"
788776
assert SessionRecipe.get_instance().config.cookie_secure is True
789777

790778
reset()
@@ -804,9 +792,7 @@ async def test_cookie_samesite_with_ec2_public_url():
804792
)
805793

806794
assert SessionRecipe.get_instance().config.cookie_domain is None
807-
assert (
808-
SessionRecipe.get_instance().config.get_cookie_same_site(None, None) == "none"
809-
)
795+
assert SessionRecipe.get_instance().config.get_cookie_same_site(None, {}) == "none"
810796
assert SessionRecipe.get_instance().config.cookie_secure is False
811797

812798
reset()
@@ -826,5 +812,5 @@ async def test_cookie_samesite_with_ec2_public_url():
826812
)
827813

828814
assert SessionRecipe.get_instance().config.cookie_domain is None
829-
assert SessionRecipe.get_instance().config.get_cookie_same_site(None, None) == "lax"
815+
assert SessionRecipe.get_instance().config.get_cookie_same_site(None, {}) == "lax"
830816
assert SessionRecipe.get_instance().config.cookie_secure is False

tests/test_config_without_core.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ def test_same_site_cookie_values(
5252
)
5353

5454
s = SessionRecipe.get_instance()
55-
assert s.config.get_cookie_same_site(None, None) == cookie_same_site
55+
assert s.config.get_cookie_same_site(None, {}) == cookie_same_site
5656
SessionRecipe.reset()
5757
MultitenancyRecipe.reset()
5858
Supertokens.reset()

0 commit comments

Comments
 (0)