repo_id
stringclasses
400 values
commit_sha
stringclasses
400 values
commit_index
int32
0
951
in_repo_split
stringclasses
1 value
cross_repo_split
stringclasses
1 value
test_file
stringlengths
7
121
test_function
stringlengths
1
108
assertion_type
stringclasses
32 values
difficulty
stringclasses
8 values
context_lines
int32
3
600
prefix
large_stringlengths
44
113k
target
large_stringlengths
1
498
anchor_sha
stringclasses
400 values
anchor_index
int32
0
951
qna_source
stringclasses
1 value
xflr6/graphviz
acf79bca4518781cad02c102e89ec4e9ce757088
240
train
train
tests/test_saving.py
test_saves_source_from_file
assert
string_literal
14
import graphviz def test_saves_source_from_file(tmp_path, src='graph spam { spam }'): path = tmp_path / 'spam.gv' path.write_text(src) stat_before = path.stat() source = graphviz.Source.from_file(path) source.save() assert path.stat().st_mtime == stat_before.st_mtime, 'file not overwritten' ...
f'{src}\n'
acf79bca4518781cad02c102e89ec4e9ce757088
240
v2_extractor_at_anchor
xflr6/graphviz
acf79bca4518781cad02c102e89ec4e9ce757088
240
train
train
tests/test_saving.py
test_saves_source_from_file
assert
complex_expr
12
import graphviz def test_saves_source_from_file(tmp_path, src='graph spam { spam }'): path = tmp_path / 'spam.gv' path.write_text(src) stat_before = path.stat() source = graphviz.Source.from_file(path) source.save() assert path.stat().st_mtime ==
stat_before.st_mtime
acf79bca4518781cad02c102e89ec4e9ce757088
240
v2_extractor_at_anchor
xflr6/graphviz
acf79bca4518781cad02c102e89ec4e9ce757088
240
train
train
tests/test_sources.py
test_from_file
assert
string_literal
22
import locale import pytest import graphviz SOURCE = {'source': 'digraph { hello -> world }\n', 'filename': 'hello.gv', 'directory': 'test-output', 'format': 'PNG', 'engine': 'NEATO', 'encoding': 'utf-8'} def source(): return graphviz.Source(**SOURCE) def test_from_file(tmp_path, filename='...
'utf-8'
acf79bca4518781cad02c102e89ec4e9ce757088
240
v2_extractor_at_anchor
xflr6/graphviz
acf79bca4518781cad02c102e89ec4e9ce757088
240
train
train
tests/test_sources.py
test_from_file
assert
variable
32
import locale import pytest import graphviz SOURCE = {'source': 'digraph { hello -> world }\n', 'filename': 'hello.gv', 'directory': 'test-output', 'format': 'PNG', 'engine': 'NEATO', 'encoding': 'utf-8'} def source(): return graphviz.Source(**SOURCE) def test_from_file(tmp_path, filename='...
filename
acf79bca4518781cad02c102e89ec4e9ce757088
240
v2_extractor_at_anchor
xflr6/graphviz
acf79bca4518781cad02c102e89ec4e9ce757088
240
train
train
tests/test_sources.py
test_from_file
assert
variable
34
import locale import pytest import graphviz SOURCE = {'source': 'digraph { hello -> world }\n', 'filename': 'hello.gv', 'directory': 'test-output', 'format': 'PNG', 'engine': 'NEATO', 'encoding': 'utf-8'} def source(): return graphviz.Source(**SOURCE) def test_from_file(tmp_path, filename='...
encoding
acf79bca4518781cad02c102e89ec4e9ce757088
240
v2_extractor_at_anchor
xflr6/graphviz
acf79bca4518781cad02c102e89ec4e9ce757088
240
train
train
tests/test_sources.py
test_from_file
assert
variable
35
import locale import pytest import graphviz SOURCE = {'source': 'digraph { hello -> world }\n', 'filename': 'hello.gv', 'directory': 'test-output', 'format': 'PNG', 'engine': 'NEATO', 'encoding': 'utf-8'} def source(): return graphviz.Source(**SOURCE) def test_from_file(tmp_path, filename='...
renderer
acf79bca4518781cad02c102e89ec4e9ce757088
240
v2_extractor_at_anchor
xflr6/graphviz
acf79bca4518781cad02c102e89ec4e9ce757088
240
train
train
tests/test_sources.py
test_from_file
assert
variable
36
import locale import pytest import graphviz SOURCE = {'source': 'digraph { hello -> world }\n', 'filename': 'hello.gv', 'directory': 'test-output', 'format': 'PNG', 'engine': 'NEATO', 'encoding': 'utf-8'} def source(): return graphviz.Source(**SOURCE) def test_from_file(tmp_path, filename='...
formatter
acf79bca4518781cad02c102e89ec4e9ce757088
240
v2_extractor_at_anchor
xflr6/graphviz
acf79bca4518781cad02c102e89ec4e9ce757088
240
train
train
tests/test_sources.py
test_init_filename
assert
string_literal
16
import locale import pytest import graphviz SOURCE = {'source': 'digraph { hello -> world }\n', 'filename': 'hello.gv', 'directory': 'test-output', 'format': 'PNG', 'engine': 'NEATO', 'encoding': 'utf-8'} def source(): return graphviz.Source(**SOURCE) def test_init_filename(): assert g...
'Source.gv'
acf79bca4518781cad02c102e89ec4e9ce757088
240
v2_extractor_at_anchor
xflr6/graphviz
acf79bca4518781cad02c102e89ec4e9ce757088
240
train
train
tests/test_sources.py
test_init_filename
assert
string_literal
17
import locale import pytest import graphviz SOURCE = {'source': 'digraph { hello -> world }\n', 'filename': 'hello.gv', 'directory': 'test-output', 'format': 'PNG', 'engine': 'NEATO', 'encoding': 'utf-8'} def source(): return graphviz.Source(**SOURCE) def test_init_filename(): assert gr...
'Subcls.gv'
acf79bca4518781cad02c102e89ec4e9ce757088
240
v2_extractor_at_anchor
xflr6/graphviz
acf79bca4518781cad02c102e89ec4e9ce757088
240
train
train
tests/test_sources.py
test_init
assert
complex_expr
16
import locale import pytest import graphviz SOURCE = {'source': 'digraph { hello -> world }\n', 'filename': 'hello.gv', 'directory': 'test-output', 'format': 'PNG', 'engine': 'NEATO', 'encoding': 'utf-8'} def source(): return graphviz.Source(**SOURCE) def test_init(source): assert sour...
SOURCE['source']
acf79bca4518781cad02c102e89ec4e9ce757088
240
v2_extractor_at_anchor
xflr6/graphviz
acf79bca4518781cad02c102e89ec4e9ce757088
240
train
train
tests/test_sources.py
test_source_iter
assert
func_call
19
import locale import pytest import graphviz SOURCE = {'source': 'digraph { hello -> world }\n', 'filename': 'hello.gv', 'directory': 'test-output', 'format': 'PNG', 'engine': 'NEATO', 'encoding': 'utf-8'} def source(): return graphviz.Source(**SOURCE) def test_source_iter(source): sourc...
list(source) * 2
acf79bca4518781cad02c102e89ec4e9ce757088
240
v2_extractor_at_anchor
xflr6/graphviz
acf79bca4518781cad02c102e89ec4e9ce757088
240
train
train
tests/test_sources.py
test_init
assert
complex_expr
17
import locale import pytest import graphviz SOURCE = {'source': 'digraph { hello -> world }\n', 'filename': 'hello.gv', 'directory': 'test-output', 'format': 'PNG', 'engine': 'NEATO', 'encoding': 'utf-8'} def source(): return graphviz.Source(**SOURCE) def test_init(source): assert sourc...
SOURCE['filename']
acf79bca4518781cad02c102e89ec4e9ce757088
240
v2_extractor_at_anchor
xflr6/graphviz
acf79bca4518781cad02c102e89ec4e9ce757088
240
train
train
tests/test_sources.py
test_init
assert
complex_expr
18
import locale import pytest import graphviz SOURCE = {'source': 'digraph { hello -> world }\n', 'filename': 'hello.gv', 'directory': 'test-output', 'format': 'PNG', 'engine': 'NEATO', 'encoding': 'utf-8'} def source(): return graphviz.Source(**SOURCE) def test_init(source): assert sourc...
SOURCE['directory']
acf79bca4518781cad02c102e89ec4e9ce757088
240
v2_extractor_at_anchor
xflr6/graphviz
acf79bca4518781cad02c102e89ec4e9ce757088
240
train
train
tests/test_sources.py
test_filepath
assert
string_literal
19
import locale import pytest import graphviz SOURCE = {'source': 'digraph { hello -> world }\n', 'filename': 'hello.gv', 'directory': 'test-output', 'format': 'PNG', 'engine': 'NEATO', 'encoding': 'utf-8'} def source(): return graphviz.Source(**SOURCE) def test_filepath(platform, source): ...
'test-output/hello.gv'
acf79bca4518781cad02c102e89ec4e9ce757088
240
v2_extractor_at_anchor
xflr6/graphviz
acf79bca4518781cad02c102e89ec4e9ce757088
240
train
train
tests/test_sources.py
test_filepath
assert
string_literal
17
import locale import pytest import graphviz SOURCE = {'source': 'digraph { hello -> world }\n', 'filename': 'hello.gv', 'directory': 'test-output', 'format': 'PNG', 'engine': 'NEATO', 'encoding': 'utf-8'} def source(): return graphviz.Source(**SOURCE) def test_filepath(platform, source): ...
'test-output\\hello.gv'
acf79bca4518781cad02c102e89ec4e9ce757088
240
v2_extractor_at_anchor
xflr6/graphviz
acf79bca4518781cad02c102e89ec4e9ce757088
240
train
train
tests/test_sources.py
test_source_parameter
assert
func_call
20
import locale import pytest import graphviz SOURCE = {'source': 'digraph { hello -> world }\n', 'filename': 'hello.gv', 'directory': 'test-output', 'format': 'PNG', 'engine': 'NEATO', 'encoding': 'utf-8'} def source(): return graphviz.Source(**SOURCE) @pytest.mark.parametrize( 'paramete...
SOURCE[parameter].lower()
acf79bca4518781cad02c102e89ec4e9ce757088
240
v2_extractor_at_anchor
xflr6/graphviz
acf79bca4518781cad02c102e89ec4e9ce757088
240
train
train
tests/test_tools.py
test_mkdirs
assert
collection
22
import functools import os import pytest from graphviz import tools import _common def itertree(root): for path, dirs, files in os.walk(root): base = os.path.relpath(path, root) rel_path = functools.partial(os.path.join, base if base != '.' else '') for is_file, names in enumerate((dirs,...
[]
acf79bca4518781cad02c102e89ec4e9ce757088
240
v2_extractor_at_anchor
xflr6/graphviz
acf79bca4518781cad02c102e89ec4e9ce757088
240
train
train
tests/test_tools.py
test_mkdirs_invalid
pytest.raises
variable
22
import functools import os import pytest from graphviz import tools import _common def itertree(root): for path, dirs, files in os.walk(root): base = os.path.relpath(path, root) rel_path = functools.partial(os.path.join, base if base != '.' else '') for is_file, names in enumerate((dirs,...
OSError)
acf79bca4518781cad02c102e89ec4e9ce757088
240
v2_extractor_at_anchor
xflr6/graphviz
acf79bca4518781cad02c102e89ec4e9ce757088
240
train
train
tests/test_tools.py
test_mkdirs
assert
collection
25
import functools import os import pytest from graphviz import tools import _common def itertree(root): for path, dirs, files in os.walk(root): base = os.path.relpath(path, root) rel_path = functools.partial(os.path.join, base if base != '.' else '') for is_file, names in enumerate((dirs,...
[(False, 'spam'), (False, 'spam/eggs')]
acf79bca4518781cad02c102e89ec4e9ce757088
240
v2_extractor_at_anchor
yezz123/authx
acf5543f654819bdcb000f7a0e399f9e0b175d52
51
train
train
tests/app/conftest.py
access_token
assert
numeric_literal
62
import pytest from fastapi.testclient import TestClient from httpx import Response from authx import AuthXConfig from tests.utils import ( create_blocklist_routes, create_get_token_routes, create_protected_routes, create_secure_routes, create_securities, create_subject_routes, create_token_...
200
acf5543f654819bdcb000f7a0e399f9e0b175d52
51
v2_extractor_at_anchor
yezz123/authx
acf5543f654819bdcb000f7a0e399f9e0b175d52
51
train
train
tests/app/test_access_location.py
test_access_location_cookies_no_csrf
assert
none_literal
9
from authx.config import AuthXConfig def test_access_location_cookies_no_csrf(api, access_token: str, config: AuthXConfig): response = api.post( "/read/access", cookies={config.JWT_ACCESS_COOKIE_NAME: access_token}, ) assert response.json() is
None
acf5543f654819bdcb000f7a0e399f9e0b175d52
51
v2_extractor_at_anchor
yezz123/authx
acf5543f654819bdcb000f7a0e399f9e0b175d52
51
train
train
tests/app/test_access_location.py
test_access_location_json
assert
string_literal
6
from authx.config import AuthXConfig def test_access_location_json(api, access_token: str, config: AuthXConfig): response = api.post("/read/access", json={config.JWT_JSON_KEY: access_token}) assert response.json()["location"] ==
"json"
acf5543f654819bdcb000f7a0e399f9e0b175d52
51
v2_extractor_at_anchor
yezz123/authx
acf5543f654819bdcb000f7a0e399f9e0b175d52
51
train
train
tests/app/test_access_location.py
test_access_location_query
assert
string_literal
8
from authx.config import AuthXConfig def test_access_location_query(api, access_token: str, config: AuthXConfig): response = api.post( "/read/access", params={config.JWT_QUERY_STRING_NAME: access_token} ) assert response.json()["location"] ==
"query"
acf5543f654819bdcb000f7a0e399f9e0b175d52
51
v2_extractor_at_anchor
yezz123/authx
acf5543f654819bdcb000f7a0e399f9e0b175d52
51
train
train
tests/app/test_access_location.py
test_access_location_headers
assert
string_literal
9
from authx.config import AuthXConfig def test_access_location_headers(api, access_token: str): response = api.post( "/read/access", headers={"Authorization": f"Bearer {access_token}"} ) assert response.json()["location"] == "headers" assert response.json()["type"] ==
"access"
acf5543f654819bdcb000f7a0e399f9e0b175d52
51
v2_extractor_at_anchor
yezz123/authx
acf5543f654819bdcb000f7a0e399f9e0b175d52
51
train
train
tests/app/test_access_location.py
test_access_location_headers
assert
string_literal
8
from authx.config import AuthXConfig def test_access_location_headers(api, access_token: str): response = api.post( "/read/access", headers={"Authorization": f"Bearer {access_token}"} ) assert response.json()["location"] ==
"headers"
acf5543f654819bdcb000f7a0e399f9e0b175d52
51
v2_extractor_at_anchor
yezz123/authx
acf5543f654819bdcb000f7a0e399f9e0b175d52
51
train
train
tests/app/test_access_location.py
test_access_location_cookies
assert
string_literal
12
from authx.config import AuthXConfig def test_access_location_cookies( api, access_token: str, access_csrf_token: str, config: AuthXConfig ): response = api.post( "/read/access", cookies={config.JWT_ACCESS_COOKIE_NAME: access_token}, headers={config.JWT_ACCESS_CSRF_HEADER_NAME: access_c...
"cookies"
acf5543f654819bdcb000f7a0e399f9e0b175d52
51
v2_extractor_at_anchor
yezz123/authx
acf5543f654819bdcb000f7a0e399f9e0b175d52
51
train
train
tests/app/test_blocklist_token.py
test_blocklist_access_token
assert
numeric_literal
16
import pytest import authx.exceptions as exc from authx.config import AuthXConfig def test_blocklist_access_token(api, access_token: str): # Check token not in list blocklist = api.get("/blocklist").json()["blocklist"] assert access_token not in blocklist # Check token works response = api.post( ...
200
acf5543f654819bdcb000f7a0e399f9e0b175d52
51
v2_extractor_at_anchor
yezz123/authx
acf5543f654819bdcb000f7a0e399f9e0b175d52
51
train
train
tests/app/test_blocklist_token.py
test_blocklist_access_token
assert
variable
10
import pytest import authx.exceptions as exc from authx.config import AuthXConfig def test_blocklist_access_token(api, access_token: str): # Check token not in list blocklist = api.get("/blocklist").json()["blocklist"] assert access_token not in
blocklist
acf5543f654819bdcb000f7a0e399f9e0b175d52
51
v2_extractor_at_anchor
yezz123/authx
acf5543f654819bdcb000f7a0e399f9e0b175d52
51
train
train
tests/app/test_blocklist_token.py
test_blocklist_access_token
pytest.raises
complex_expr
29
import pytest import authx.exceptions as exc from authx.config import AuthXConfig def test_blocklist_access_token(api, access_token: str): # Check token not in list blocklist = api.get("/blocklist").json()["blocklist"] assert access_token not in blocklist # Check token works response = api.post( ...
exc.RevokedTokenError)
acf5543f654819bdcb000f7a0e399f9e0b175d52
51
v2_extractor_at_anchor
yezz123/authx
acf5543f654819bdcb000f7a0e399f9e0b175d52
51
train
train
tests/app/test_fresh_token.py
test_fresh_token_protected_fresh_headers
assert
numeric_literal
11
import pytest import authx.exceptions as exc from authx.config import AuthXConfig def test_fresh_token_protected_fresh_headers(api, fresh_token: str): response = api.post( "/protected/fresh", headers={"Authorization": f"Bearer {fresh_token}"} ) assert response.status_code ==
200
acf5543f654819bdcb000f7a0e399f9e0b175d52
51
v2_extractor_at_anchor
yezz123/authx
acf5543f654819bdcb000f7a0e399f9e0b175d52
51
train
train
tests/app/test_fresh_token.py
test_no_token_protected_fresh
pytest.raises
complex_expr
8
import pytest import authx.exceptions as exc from authx.config import AuthXConfig def test_no_token_protected_fresh(api): with pytest.raises(
exc.MissingTokenError)
acf5543f654819bdcb000f7a0e399f9e0b175d52
51
v2_extractor_at_anchor
yezz123/authx
acf5543f654819bdcb000f7a0e399f9e0b175d52
51
train
train
tests/app/test_fresh_token.py
test_access_fresh_token_protected_fresh
pytest.raises
complex_expr
8
import pytest import authx.exceptions as exc from authx.config import AuthXConfig def test_access_fresh_token_protected_fresh(api, access_token: str): with pytest.raises(
exc.FreshTokenRequiredError)
acf5543f654819bdcb000f7a0e399f9e0b175d52
51
v2_extractor_at_anchor
yezz123/authx
acf5543f654819bdcb000f7a0e399f9e0b175d52
51
train
train
tests/app/test_fresh_token.py
test_refresh_fresh_token_protected_fresh
pytest.raises
complex_expr
8
import pytest import authx.exceptions as exc from authx.config import AuthXConfig def test_refresh_fresh_token_protected_fresh(api, refresh_token: str): with pytest.raises(
exc.AccessTokenRequiredError)
acf5543f654819bdcb000f7a0e399f9e0b175d52
51
v2_extractor_at_anchor
yezz123/authx
acf5543f654819bdcb000f7a0e399f9e0b175d52
51
train
train
tests/app/test_fresh_token.py
test_access_token_protected_refresh
pytest.raises
complex_expr
10
import pytest import authx.exceptions as exc from authx.config import AuthXConfig def test_access_token_protected_refresh( api, config: AuthXConfig, access_token: str, access_csrf_token: str ): with pytest.raises(
exc.RefreshTokenRequiredError)
acf5543f654819bdcb000f7a0e399f9e0b175d52
51
v2_extractor_at_anchor
yezz123/authx
acf5543f654819bdcb000f7a0e399f9e0b175d52
51
train
train
tests/app/test_get_subject.py
test_get_subject_resources
assert
numeric_literal
22
import pytest import authx.exceptions as exc def test_get_subject_resources(api, access_token: str): response = _test_get_subject_resources(api, access_token, 0) response = api.post( "/entity/resources", json={"subject": "test", "resource": "A dummy resources"}, ) response = _test_get...
2
acf5543f654819bdcb000f7a0e399f9e0b175d52
51
v2_extractor_at_anchor
yezz123/authx
acf5543f654819bdcb000f7a0e399f9e0b175d52
51
train
train
tests/app/test_get_subject.py
test_get_subject_access_token
assert
numeric_literal
10
import pytest import authx.exceptions as exc def test_get_subject_access_token(api, access_token: str): response = api.get( "/entity/subject", headers={"Authorization": f"Bearer {access_token}"} ) assert response.status_code ==
200
acf5543f654819bdcb000f7a0e399f9e0b175d52
51
v2_extractor_at_anchor
yezz123/authx
acf5543f654819bdcb000f7a0e399f9e0b175d52
51
train
train
tests/app/test_get_subject.py
test_get_subject
assert
string_literal
11
import pytest import authx.exceptions as exc def test_get_subject(api, access_token: str): response = api.get( "/entity/subject", headers={"Authorization": f"Bearer {access_token}"} ) assert response.status_code == 200 assert response.json()["subject"]["uid"] ==
"test"
acf5543f654819bdcb000f7a0e399f9e0b175d52
51
v2_extractor_at_anchor
yezz123/authx
acf5543f654819bdcb000f7a0e399f9e0b175d52
51
train
train
tests/app/test_get_subject.py
_test_get_subject_resources
assert
variable
12
import pytest import authx.exceptions as exc def _test_get_subject_resources(api, access_token, argument): result = api.get( "/entity/subject/resources", headers={"Authorization": f"Bearer {access_token}"}, ) assert result.status_code == 200 assert len(result.json()["resources"]) ==
argument
acf5543f654819bdcb000f7a0e399f9e0b175d52
51
v2_extractor_at_anchor
yezz123/authx
acf5543f654819bdcb000f7a0e399f9e0b175d52
51
train
train
tests/app/test_get_subject.py
test_get_subject
assert
string_literal
12
import pytest import authx.exceptions as exc def test_get_subject(api, access_token: str): response = api.get( "/entity/subject", headers={"Authorization": f"Bearer {access_token}"} ) assert response.status_code == 200 assert response.json()["subject"]["uid"] == "test" assert response.jso...
"test@test.com"
acf5543f654819bdcb000f7a0e399f9e0b175d52
51
v2_extractor_at_anchor
yezz123/authx
acf5543f654819bdcb000f7a0e399f9e0b175d52
51
train
train
tests/app/test_get_subject.py
test_no_authorization_get_subject
pytest.raises
complex_expr
7
import pytest import authx.exceptions as exc def test_no_authorization_get_subject(api): with pytest.raises(
exc.MissingTokenError)
acf5543f654819bdcb000f7a0e399f9e0b175d52
51
v2_extractor_at_anchor
yezz123/authx
acf5543f654819bdcb000f7a0e399f9e0b175d52
51
train
train
tests/app/test_get_subject.py
test_get_subject_refresh_token
pytest.raises
complex_expr
7
import pytest import authx.exceptions as exc def test_get_subject_refresh_token(api, refresh_token: str): with pytest.raises(
exc.AccessTokenRequiredError)
acf5543f654819bdcb000f7a0e399f9e0b175d52
51
v2_extractor_at_anchor
yezz123/authx
acf5543f654819bdcb000f7a0e399f9e0b175d52
51
train
train
tests/app/test_token_protected_access.py
test_fresh_token_protected_access_headers
assert
numeric_literal
11
import pytest import authx.exceptions as exc from authx.config import AuthXConfig def test_fresh_token_protected_access_headers(api, fresh_token: str): response = api.post( "/protected/access", headers={"Authorization": f"Bearer {fresh_token}"} ) assert response.status_code ==
200
acf5543f654819bdcb000f7a0e399f9e0b175d52
51
v2_extractor_at_anchor
yezz123/authx
acf5543f654819bdcb000f7a0e399f9e0b175d52
51
train
train
tests/app/test_token_protected_access.py
test_access_token_protected_access_cookies_no_csrf
assert
complex_expr
24
import pytest import authx.exceptions as exc from authx.config import AuthXConfig def test_access_token_protected_access_cookies_no_csrf(api, config: AuthXConfig): response = api.get("/token/access") assert response.status_code == 200 assert "token" in response.json() access_token = response.json()["t...
err.value.args
acf5543f654819bdcb000f7a0e399f9e0b175d52
51
v2_extractor_at_anchor
yezz123/authx
acf5543f654819bdcb000f7a0e399f9e0b175d52
51
train
train
tests/app/test_token_protected_access.py
test_access_token_protected_access_cookies_no_csrf
assert
func_call
10
import pytest import authx.exceptions as exc from authx.config import AuthXConfig def test_access_token_protected_access_cookies_no_csrf(api, config: AuthXConfig): response = api.get("/token/access") assert response.status_code == 200 assert "token" in
response.json()
acf5543f654819bdcb000f7a0e399f9e0b175d52
51
v2_extractor_at_anchor
yezz123/authx
acf5543f654819bdcb000f7a0e399f9e0b175d52
51
train
train
tests/app/test_token_protected_access.py
test_access_token_protected_access_cookies_no_csrf
pytest.raises
complex_expr
17
import pytest import authx.exceptions as exc from authx.config import AuthXConfig def test_access_token_protected_access_cookies_no_csrf(api, config: AuthXConfig): response = api.get("/token/access") assert response.status_code == 200 assert "token" in response.json() access_token = response.json()["t...
exc.MissingTokenError)
acf5543f654819bdcb000f7a0e399f9e0b175d52
51
v2_extractor_at_anchor
yezz123/authx
acf5543f654819bdcb000f7a0e399f9e0b175d52
51
train
train
tests/app/test_token_protected_access.py
test_refresh_token_protected_access_headers
pytest.raises
complex_expr
8
import pytest import authx.exceptions as exc from authx.config import AuthXConfig def test_refresh_token_protected_access_headers(api, refresh_token: str): with pytest.raises(
exc.AccessTokenRequiredError)
acf5543f654819bdcb000f7a0e399f9e0b175d52
51
v2_extractor_at_anchor
yezz123/authx
acf5543f654819bdcb000f7a0e399f9e0b175d52
51
train
train
tests/extend/test_authx_extend.py
test_implicit_refresh_middleware
assert
none_literal
48
from datetime import timedelta import pytest from fastapi import Request from fastapi.responses import JSONResponse from starlette.datastructures import Headers, MutableHeaders from authx import AuthX from authx.exceptions import AuthXException def authx(): authx = AuthX() authx._config.JWT_SECRET_KEY = "SEC...
None
acf5543f654819bdcb000f7a0e399f9e0b175d52
51
v2_extractor_at_anchor
yezz123/authx
acf5543f654819bdcb000f7a0e399f9e0b175d52
51
train
train
tests/extend/test_authx_extend.py
test_implicit_refresh_middleware
assert
variable
49
from datetime import timedelta import pytest from fastapi import Request from fastapi.responses import JSONResponse from starlette.datastructures import Headers, MutableHeaders from authx import AuthX from authx.exceptions import AuthXException def authx(): authx = AuthX() authx._config.JWT_SECRET_KEY = "SEC...
new_token
acf5543f654819bdcb000f7a0e399f9e0b175d52
51
v2_extractor_at_anchor
yezz123/authx
acf5543f654819bdcb000f7a0e399f9e0b175d52
51
train
train
tests/extend/test_authx_extend.py
test_auth_required_revoked_token
pytest.raises
variable
42
from datetime import timedelta import pytest from fastapi import Request from fastapi.responses import JSONResponse from starlette.datastructures import Headers, MutableHeaders from authx import AuthX from authx.exceptions import AuthXException def authx(): authx = AuthX() authx._config.JWT_SECRET_KEY = "SEC...
AuthXException)
acf5543f654819bdcb000f7a0e399f9e0b175d52
51
v2_extractor_at_anchor
yezz123/authx
acf5543f654819bdcb000f7a0e399f9e0b175d52
51
train
train
tests/extend/test_authx_extend.py
test_get_current_subject
assert
collection
43
from datetime import timedelta import pytest from fastapi import Request from fastapi.responses import JSONResponse from starlette.datastructures import Headers, MutableHeaders from authx import AuthX from authx.exceptions import AuthXException def authx(): authx = AuthX() authx._config.JWT_SECRET_KEY = "SEC...
{"id": "test_user", "username": "user_test_user"}
acf5543f654819bdcb000f7a0e399f9e0b175d52
51
v2_extractor_at_anchor
yezz123/authx
acf5543f654819bdcb000f7a0e399f9e0b175d52
51
train
train
tests/internal/test_logger.py
test_log_info
assert
string_literal
17
import logging from unittest.mock import patch from authx._internal._logger import ( _build_log_msg, get_logger, log_debug, log_error, log_info, set_log_level, ) def test_log_info(caplog): log_info("Info message") assert "Info message" in caplog.text assert logging.getLevelName(ca...
"INFO"
acf5543f654819bdcb000f7a0e399f9e0b175d52
51
v2_extractor_at_anchor
yezz123/authx
acf5543f654819bdcb000f7a0e399f9e0b175d52
51
train
train
tests/internal/test_logger.py
test_log_debug
assert
string_literal
17
import logging from unittest.mock import patch from authx._internal._logger import ( _build_log_msg, get_logger, log_debug, log_error, log_info, set_log_level, ) def test_log_debug(caplog): log_debug("Debug message") assert "Debug message" in caplog.text assert logging.getLevelNam...
"DEBUG"
acf5543f654819bdcb000f7a0e399f9e0b175d52
51
v2_extractor_at_anchor
yezz123/authx
acf5543f654819bdcb000f7a0e399f9e0b175d52
51
train
train
tests/internal/test_logger.py
test_log_error
assert
string_literal
20
import logging from unittest.mock import patch from authx._internal._logger import ( _build_log_msg, get_logger, log_debug, log_error, log_info, set_log_level, ) def test_log_error(caplog): with patch("traceback.format_exc") as mock_format_exc: mock_format_exc.return_value = "Trace...
"ERROR"
acf5543f654819bdcb000f7a0e399f9e0b175d52
51
v2_extractor_at_anchor
yezz123/authx
acf5543f654819bdcb000f7a0e399f9e0b175d52
51
train
train
tests/internal/test_logger.py
test_log_debug
assert
complex_expr
16
import logging from unittest.mock import patch from authx._internal._logger import ( _build_log_msg, get_logger, log_debug, log_error, log_info, set_log_level, ) def test_log_debug(caplog): log_debug("Debug message") assert "Debug message" in
caplog.text
acf5543f654819bdcb000f7a0e399f9e0b175d52
51
v2_extractor_at_anchor
yezz123/authx
acf5543f654819bdcb000f7a0e399f9e0b175d52
51
train
train
tests/internal/test_logger.py
test_set_log_level
assert
complex_expr
16
import logging from unittest.mock import patch from authx._internal._logger import ( _build_log_msg, get_logger, log_debug, log_error, log_info, set_log_level, ) def test_set_log_level(): logger = set_log_level(logging.DEBUG) assert logger.getEffectiveLevel() ==
logging.DEBUG
acf5543f654819bdcb000f7a0e399f9e0b175d52
51
v2_extractor_at_anchor
yezz123/authx
acf5543f654819bdcb000f7a0e399f9e0b175d52
51
train
train
tests/internal/test_logger.py
test_build_log_msg_no_loc_or_method
assert
string_literal
16
import logging from unittest.mock import patch from authx._internal._logger import ( _build_log_msg, get_logger, log_debug, log_error, log_info, set_log_level, ) def test_build_log_msg_no_loc_or_method(): result = _build_log_msg("Test message") assert result ==
"Test message"
acf5543f654819bdcb000f7a0e399f9e0b175d52
51
v2_extractor_at_anchor
yezz123/authx
acf5543f654819bdcb000f7a0e399f9e0b175d52
51
train
train
tests/internal/test_logger.py
test_build_log_msg_with_loc
assert
string_literal
16
import logging from unittest.mock import patch from authx._internal._logger import ( _build_log_msg, get_logger, log_debug, log_error, log_info, set_log_level, ) def test_build_log_msg_with_loc(): result = _build_log_msg("Test message", loc="test_location") assert result ==
"[test_location] Test message"
acf5543f654819bdcb000f7a0e399f9e0b175d52
51
v2_extractor_at_anchor
yezz123/authx
acf5543f654819bdcb000f7a0e399f9e0b175d52
51
train
train
tests/internal/test_logger.py
test_build_log_msg_with_method
assert
string_literal
16
import logging from unittest.mock import patch from authx._internal._logger import ( _build_log_msg, get_logger, log_debug, log_error, log_info, set_log_level, ) def test_build_log_msg_with_method(): result = _build_log_msg("Test message", method="test_method") assert result ==
"[None][test_method] Test message"
acf5543f654819bdcb000f7a0e399f9e0b175d52
51
v2_extractor_at_anchor
yezz123/authx
acf5543f654819bdcb000f7a0e399f9e0b175d52
51
train
train
tests/internal/test_logger.py
test_build_log_msg_with_loc_and_method
assert
string_literal
16
import logging from unittest.mock import patch from authx._internal._logger import ( _build_log_msg, get_logger, log_debug, log_error, log_info, set_log_level, ) def test_build_log_msg_with_loc_and_method(): result = _build_log_msg("Test message", loc="test_location", method="test_method")...
"[test_location][test_method] [test_location] Test message"
acf5543f654819bdcb000f7a0e399f9e0b175d52
51
v2_extractor_at_anchor
yezz123/authx
acf5543f654819bdcb000f7a0e399f9e0b175d52
51
train
train
tests/internal/test_memory.py
test_create_store
assert
collection
14
from time import time import pytest from authx._internal import MemoryIO def memory_io(): return MemoryIO() def test_create_store(memory_io): session_id = "123" store = memory_io.create_store(session_id) assert store ==
{}
acf5543f654819bdcb000f7a0e399f9e0b175d52
51
v2_extractor_at_anchor
yezz123/authx
acf5543f654819bdcb000f7a0e399f9e0b175d52
51
train
train
tests/internal/test_memory.py
test_gc_cleanup_old_sessions
assert
numeric_literal
32
from time import time import pytest from authx._internal import MemoryIO def memory_io(): return MemoryIO() def test_gc_cleanup_old_sessions(memory_io): # Populate raw_memory_store with 100 sessions older than 12 hours current_time = int(time()) twelve_hours_ago = current_time - 3600 * 12 for i ...
101
acf5543f654819bdcb000f7a0e399f9e0b175d52
51
v2_extractor_at_anchor
yezz123/authx
acf5543f654819bdcb000f7a0e399f9e0b175d52
51
train
train
tests/internal/test_memory.py
test_get_store_nonexistent
assert
none_literal
14
from time import time import pytest from authx._internal import MemoryIO def memory_io(): return MemoryIO() def test_get_store_nonexistent(memory_io): session_id = "123" store = memory_io.get_store(session_id) assert store is
None
acf5543f654819bdcb000f7a0e399f9e0b175d52
51
v2_extractor_at_anchor
yezz123/authx
acf5543f654819bdcb000f7a0e399f9e0b175d52
51
train
train
tests/internal/test_memory.py
test_cleanup_old_sessions
assert
variable
23
from time import time import pytest from authx._internal import MemoryIO def memory_io(): return MemoryIO() def test_cleanup_old_sessions(memory_io): current_time = int(time()) memory_io.raw_memory_store = { "1": {"created_at": current_time - 3600 * 12 - 1, "store": {}}, "2": {"created_a...
expected_output
acf5543f654819bdcb000f7a0e399f9e0b175d52
51
v2_extractor_at_anchor
yezz123/authx
acf5543f654819bdcb000f7a0e399f9e0b175d52
51
train
train
tests/internal/test_memory.py
test_get_store_existing
assert
collection
18
from time import time import pytest from authx._internal import MemoryIO def memory_io(): return MemoryIO() def test_get_store_existing(memory_io): session_id = "123" memory_io.raw_memory_store[session_id] = { "created_at": int(time()), "store": {"key": "value"}, } store = memory...
{"key": "value"}
acf5543f654819bdcb000f7a0e399f9e0b175d52
51
v2_extractor_at_anchor
yezz123/authx
acf5543f654819bdcb000f7a0e399f9e0b175d52
51
train
train
tests/internal/test_memory.py
test_gc_cleanup_old_sessions
assert
complex_expr
33
from time import time import pytest from authx._internal import MemoryIO def memory_io(): return MemoryIO() def test_gc_cleanup_old_sessions(memory_io): # Populate raw_memory_store with 100 sessions older than 12 hours current_time = int(time()) twelve_hours_ago = current_time - 3600 * 12 for i ...
memory_io.raw_memory_store
acf5543f654819bdcb000f7a0e399f9e0b175d52
51
v2_extractor_at_anchor
yezz123/authx
acf5543f654819bdcb000f7a0e399f9e0b175d52
51
train
train
tests/internal/test_signature.py
test_encode_decode_success
assert
numeric_literal
17
import time from typing import Any, Dict import pytest from authx._internal import SignatureSerializer def serializer(): return SignatureSerializer("TEST_SECRET_KEY", expired_in=1) def test_encode_decode_success(serializer): dict_obj = {"session_id": 1} token = serializer.encode(dict_obj) data, err ...
1
acf5543f654819bdcb000f7a0e399f9e0b175d52
51
v2_extractor_at_anchor
yezz123/authx
acf5543f654819bdcb000f7a0e399f9e0b175d52
51
train
train
tests/internal/test_utils.py
test_util_get_uuid
assert
numeric_literal
51
import datetime as date from datetime import datetime from datetime import timezone as datetimezone import pytest import pytz from dateutil.relativedelta import relativedelta from freezegun import freeze_time from pytz import timezone from authx._internal._utils import ( IST_time, beginning_of_day, days_a...
36
acf5543f654819bdcb000f7a0e399f9e0b175d52
51
v2_extractor_at_anchor
yezz123/authx
acf5543f654819bdcb000f7a0e399f9e0b175d52
51
train
train
tests/internal/test_utils.py
test_is_today
assert
bool_literal
51
import datetime as date from datetime import datetime from datetime import timezone as datetimezone import pytest import pytz from dateutil.relativedelta import relativedelta from freezegun import freeze_time from pytz import timezone from authx._internal._utils import ( IST_time, beginning_of_day, days_a...
True
acf5543f654819bdcb000f7a0e399f9e0b175d52
51
v2_extractor_at_anchor
yezz123/authx
acf5543f654819bdcb000f7a0e399f9e0b175d52
51
train
train
tests/internal/test_utils.py
test_is_today
assert
bool_literal
52
import datetime as date from datetime import datetime from datetime import timezone as datetimezone import pytest import pytz from dateutil.relativedelta import relativedelta from freezegun import freeze_time from pytz import timezone from authx._internal._utils import ( IST_time, beginning_of_day, days_a...
False
acf5543f654819bdcb000f7a0e399f9e0b175d52
51
v2_extractor_at_anchor
yezz123/authx
acf5543f654819bdcb000f7a0e399f9e0b175d52
51
train
train
tests/internal/test_utils.py
test_to_UTC
assert
variable
52
import datetime as date from datetime import datetime from datetime import timezone as datetimezone import pytest import pytz from dateutil.relativedelta import relativedelta from freezegun import freeze_time from pytz import timezone from authx._internal._utils import ( IST_time, beginning_of_day, days_a...
expected_result
acf5543f654819bdcb000f7a0e399f9e0b175d52
51
v2_extractor_at_anchor
yezz123/authx
acf5543f654819bdcb000f7a0e399f9e0b175d52
51
train
train
tests/test_authx.py
test_set_and_unset_cookies
assert
numeric_literal
43
import json import pytest from fastapi import Request from fastapi.responses import JSONResponse from authx import AuthX, RequestToken, TokenPayload from authx.config import AuthXConfig from authx.exceptions import AuthXException, MissingTokenError def authx(): authx = AuthX() authx._config.JWT_SECRET_KEY = ...
4
acf5543f654819bdcb000f7a0e399f9e0b175d52
51
v2_extractor_at_anchor
yezz123/authx
acf5543f654819bdcb000f7a0e399f9e0b175d52
51
train
train
tests/test_authx.py
test_set_and_unset_cookies
assert
numeric_literal
49
import json import pytest from fastapi import Request from fastapi.responses import JSONResponse from authx import AuthX, RequestToken, TokenPayload from authx.config import AuthXConfig from authx.exceptions import AuthXException, MissingTokenError def authx(): authx = AuthX() authx._config.JWT_SECRET_KEY = ...
8
acf5543f654819bdcb000f7a0e399f9e0b175d52
51
v2_extractor_at_anchor
yezz123/authx
acf5543f654819bdcb000f7a0e399f9e0b175d52
51
train
train
tests/test_authx.py
test_create_refresh_token
assert
bool_literal
40
import json import pytest from fastapi import Request from fastapi.responses import JSONResponse from authx import AuthX, RequestToken, TokenPayload from authx.config import AuthXConfig from authx.exceptions import AuthXException, MissingTokenError def authx(): authx = AuthX() authx._config.JWT_SECRET_KEY = ...
True
acf5543f654819bdcb000f7a0e399f9e0b175d52
51
v2_extractor_at_anchor
yezz123/authx
acf5543f654819bdcb000f7a0e399f9e0b175d52
51
train
train
tests/test_authx.py
test_get_token_from_request_access
assert
none_literal
48
import json import pytest from fastapi import Request from fastapi.responses import JSONResponse from authx import AuthX, RequestToken, TokenPayload from authx.config import AuthXConfig from authx.exceptions import AuthXException, MissingTokenError def authx(): authx = AuthX() authx._config.JWT_SECRET_KEY = ...
None
acf5543f654819bdcb000f7a0e399f9e0b175d52
51
v2_extractor_at_anchor
yezz123/authx
acf5543f654819bdcb000f7a0e399f9e0b175d52
51
train
train
tests/test_authx.py
test_create_refresh_token_with_custom_data
assert
string_literal
41
import json import pytest from fastapi import Request from fastapi.responses import JSONResponse from authx import AuthX, RequestToken, TokenPayload from authx.config import AuthXConfig from authx.exceptions import AuthXException, MissingTokenError def authx(): authx = AuthX() authx._config.JWT_SECRET_KEY = ...
"admin"
acf5543f654819bdcb000f7a0e399f9e0b175d52
51
v2_extractor_at_anchor
yezz123/authx
acf5543f654819bdcb000f7a0e399f9e0b175d52
51
train
train
tests/test_authx.py
test_create_access_token
assert
string_literal
42
import json import pytest from fastapi import Request from fastapi.responses import JSONResponse from authx import AuthX, RequestToken, TokenPayload from authx.config import AuthXConfig from authx.exceptions import AuthXException, MissingTokenError def authx(): authx = AuthX() authx._config.JWT_SECRET_KEY = ...
"access"
acf5543f654819bdcb000f7a0e399f9e0b175d52
51
v2_extractor_at_anchor
yezz123/authx
acf5543f654819bdcb000f7a0e399f9e0b175d52
51
train
train
tests/test_authx.py
test_create_access_token
assert
string_literal
41
import json import pytest from fastapi import Request from fastapi.responses import JSONResponse from authx import AuthX, RequestToken, TokenPayload from authx.config import AuthXConfig from authx.exceptions import AuthXException, MissingTokenError def authx(): authx = AuthX() authx._config.JWT_SECRET_KEY = ...
"blablah"
acf5543f654819bdcb000f7a0e399f9e0b175d52
51
v2_extractor_at_anchor
yezz123/authx
acf5543f654819bdcb000f7a0e399f9e0b175d52
51
train
train
tests/test_authx.py
test_create_refresh_token
assert
string_literal
42
import json import pytest from fastapi import Request from fastapi.responses import JSONResponse from authx import AuthX, RequestToken, TokenPayload from authx.config import AuthXConfig from authx.exceptions import AuthXException, MissingTokenError def authx(): authx = AuthX() authx._config.JWT_SECRET_KEY = ...
"refresh"
acf5543f654819bdcb000f7a0e399f9e0b175d52
51
v2_extractor_at_anchor
yezz123/authx
acf5543f654819bdcb000f7a0e399f9e0b175d52
51
train
train
tests/test_authx.py
test_get_token_from_request_access
assert
string_literal
47
import json import pytest from fastapi import Request from fastapi.responses import JSONResponse from authx import AuthX, RequestToken, TokenPayload from authx.config import AuthXConfig from authx.exceptions import AuthXException, MissingTokenError def authx(): authx = AuthX() authx._config.JWT_SECRET_KEY = ...
"headers"
acf5543f654819bdcb000f7a0e399f9e0b175d52
51
v2_extractor_at_anchor
yezz123/authx
acf5543f654819bdcb000f7a0e399f9e0b175d52
51
train
train
tests/test_authx.py
test_get_token_from_request_refresh
assert
string_literal
52
import json import pytest from fastapi import Request from fastapi.responses import JSONResponse from authx import AuthX, RequestToken, TokenPayload from authx.config import AuthXConfig from authx.exceptions import AuthXException, MissingTokenError def authx(): authx = AuthX() authx._config.JWT_SECRET_KEY = ...
"cookies"
acf5543f654819bdcb000f7a0e399f9e0b175d52
51
v2_extractor_at_anchor
yezz123/authx
acf5543f654819bdcb000f7a0e399f9e0b175d52
51
train
train
tests/test_authx.py
test_set_wrong_token_type_cookie_exception
pytest.raises
variable
40
import json import pytest from fastapi import Request from fastapi.responses import JSONResponse from authx import AuthX, RequestToken, TokenPayload from authx.config import AuthXConfig from authx.exceptions import AuthXException, MissingTokenError def authx(): authx = AuthX() authx._config.JWT_SECRET_KEY = ...
ValueError)
acf5543f654819bdcb000f7a0e399f9e0b175d52
51
v2_extractor_at_anchor
yezz123/authx
acf5543f654819bdcb000f7a0e399f9e0b175d52
51
train
train
tests/test_callback.py
test_callback_handler_initialization
assert
none_literal
11
from typing import Optional from unittest.mock import Mock, patch import pytest from authx._internal import _CallbackHandler def test_callback_handler_initialization(): handler = _CallbackHandler() assert handler._model is
None
acf5543f654819bdcb000f7a0e399f9e0b175d52
51
v2_extractor_at_anchor
yezz123/authx
acf5543f654819bdcb000f7a0e399f9e0b175d52
51
train
train
tests/test_callback.py
test_check_model_callback_is_set
assert
bool_literal
22
from typing import Optional from unittest.mock import Mock, patch import pytest from authx._internal import _CallbackHandler def test_check_model_callback_is_set(): handler = _CallbackHandler() # Test when callback is not set with pytest.raises(AttributeError): handler._check_model_callback_is_s...
True
acf5543f654819bdcb000f7a0e399f9e0b175d52
51
v2_extractor_at_anchor
yezz123/authx
acf5543f654819bdcb000f7a0e399f9e0b175d52
51
train
train
tests/test_callback.py
test_get_current_subject
assert
string_literal
19
from typing import Optional from unittest.mock import Mock, patch import pytest from authx._internal import _CallbackHandler def test_get_current_subject(): handler = _CallbackHandler() def model_callback(uid: str, **kwargs) -> Optional[DummyModel]: return DummyModel(uid) if uid else None handl...
"123"
acf5543f654819bdcb000f7a0e399f9e0b175d52
51
v2_extractor_at_anchor
yezz123/authx
acf5543f654819bdcb000f7a0e399f9e0b175d52
51
train
train
tests/test_callback.py
test_edge_case_model_with_handler
assert
variable
15
from typing import Optional from unittest.mock import Mock, patch import pytest from authx._internal import _CallbackHandler def test_edge_case_model_with_handler(): class ModelWithHandler: def __init__(self): self.handler = _CallbackHandler(self) model = ModelWithHandler() assert m...
model
acf5543f654819bdcb000f7a0e399f9e0b175d52
51
v2_extractor_at_anchor
yezz123/authx
acf5543f654819bdcb000f7a0e399f9e0b175d52
51
train
train
tests/test_callback.py
test_check_model_callback_is_set
assert
bool_literal
16
from typing import Optional from unittest.mock import Mock, patch import pytest from authx._internal import _CallbackHandler def test_check_model_callback_is_set(): handler = _CallbackHandler() # Test when callback is not set with pytest.raises(AttributeError): handler._check_model_callback_is_s...
False
acf5543f654819bdcb000f7a0e399f9e0b175d52
51
v2_extractor_at_anchor
yezz123/authx
acf5543f654819bdcb000f7a0e399f9e0b175d52
51
train
train
tests/test_callback.py
test_is_token_in_blocklist_none_callback
assert_*
string_literal
23
from typing import Optional from unittest.mock import Mock, patch import pytest from authx._internal import _CallbackHandler def test_is_token_in_blocklist_none_callback(): handler = _CallbackHandler() # Set the callback to None explicitly handler.callback_is_token_in_blocklist = None # The method ...
"any_token")
acf5543f654819bdcb000f7a0e399f9e0b175d52
51
v2_extractor_at_anchor
yezz123/authx
acf5543f654819bdcb000f7a0e399f9e0b175d52
51
train
train
tests/test_callback.py
test_edge_case_kwargs_passing
assert
string_literal
23
from typing import Optional from unittest.mock import Mock, patch import pytest from authx._internal import _CallbackHandler def test_edge_case_kwargs_passing(): handler = _CallbackHandler() def model_callback(uid: str, **kwargs) -> Optional[DummyModel]: if "extra" in kwargs and kwargs["extra"] == "...
"special_123"
acf5543f654819bdcb000f7a0e399f9e0b175d52
51
v2_extractor_at_anchor
yezz123/authx
acf5543f654819bdcb000f7a0e399f9e0b175d52
51
train
train
tests/test_callback.py
test_is_token_in_blocklist_callback_execution
assert_*
string_literal
21
from typing import Optional from unittest.mock import Mock, patch import pytest from authx._internal import _CallbackHandler def test_is_token_in_blocklist_callback_execution(): handler = _CallbackHandler() with patch.object(handler, "_check_token_callback_is_set", return_value=True): # Test when ca...
"test_token")
acf5543f654819bdcb000f7a0e399f9e0b175d52
51
v2_extractor_at_anchor
yezz123/authx
acf5543f654819bdcb000f7a0e399f9e0b175d52
51
train
train
tests/test_config.py
test_config_has_location
assert
bool_literal
21
import pytest from authx import AuthXConfig from authx.exceptions import BadConfigurationError def config() -> AuthXConfig: config = AuthXConfig() config.JWT_ALGORITHM = "HS256" config.JWT_SECRET_KEY = "4321J4OP3JIB12BJ4NKJF2EBJE2" config.JWT_TOKEN_LOCATION = ["headers", "cookies", "json", "query"] ...
False
acf5543f654819bdcb000f7a0e399f9e0b175d52
51
v2_extractor_at_anchor
yezz123/authx
acf5543f654819bdcb000f7a0e399f9e0b175d52
51
train
train
tests/test_config.py
test_config__get_key
assert
string_literal
21
import pytest from authx import AuthXConfig from authx.exceptions import BadConfigurationError def config() -> AuthXConfig: config = AuthXConfig() config.JWT_ALGORITHM = "HS256" config.JWT_SECRET_KEY = "4321J4OP3JIB12BJ4NKJF2EBJE2" config.JWT_TOKEN_LOCATION = ["headers", "cookies", "json", "query"] ...
"TEST"
acf5543f654819bdcb000f7a0e399f9e0b175d52
51
v2_extractor_at_anchor
yezz123/authx
acf5543f654819bdcb000f7a0e399f9e0b175d52
51
train
train
tests/test_config.py
test_config__get_key
assert
string_literal
24
import pytest from authx import AuthXConfig from authx.exceptions import BadConfigurationError def config() -> AuthXConfig: config = AuthXConfig() config.JWT_ALGORITHM = "HS256" config.JWT_SECRET_KEY = "4321J4OP3JIB12BJ4NKJF2EBJE2" config.JWT_TOKEN_LOCATION = ["headers", "cookies", "json", "query"] ...
"SECRET"
acf5543f654819bdcb000f7a0e399f9e0b175d52
51
v2_extractor_at_anchor
yezz123/authx
acf5543f654819bdcb000f7a0e399f9e0b175d52
51
train
train
tests/test_config.py
test_config_symmetric_key
assert
complex_expr
23
import pytest from authx import AuthXConfig from authx.exceptions import BadConfigurationError def config() -> AuthXConfig: config = AuthXConfig() config.JWT_ALGORITHM = "HS256" config.JWT_SECRET_KEY = "4321J4OP3JIB12BJ4NKJF2EBJE2" config.JWT_TOKEN_LOCATION = ["headers", "cookies", "json", "query"] ...
config.JWT_SECRET_KEY
acf5543f654819bdcb000f7a0e399f9e0b175d52
51
v2_extractor_at_anchor
yezz123/authx
acf5543f654819bdcb000f7a0e399f9e0b175d52
51
train
train
tests/test_config.py
test_config_asymmetric_key
assert
complex_expr
24
import pytest from authx import AuthXConfig from authx.exceptions import BadConfigurationError def config() -> AuthXConfig: config = AuthXConfig() config.JWT_ALGORITHM = "HS256" config.JWT_SECRET_KEY = "4321J4OP3JIB12BJ4NKJF2EBJE2" config.JWT_TOKEN_LOCATION = ["headers", "cookies", "json", "query"] ...
config.JWT_PUBLIC_KEY
acf5543f654819bdcb000f7a0e399f9e0b175d52
51
v2_extractor_at_anchor
yezz123/authx
acf5543f654819bdcb000f7a0e399f9e0b175d52
51
train
train
tests/test_config.py
test_config_asymmetric_key
assert
complex_expr
23
import pytest from authx import AuthXConfig from authx.exceptions import BadConfigurationError def config() -> AuthXConfig: config = AuthXConfig() config.JWT_ALGORITHM = "HS256" config.JWT_SECRET_KEY = "4321J4OP3JIB12BJ4NKJF2EBJE2" config.JWT_TOKEN_LOCATION = ["headers", "cookies", "json", "query"] ...
config.JWT_PRIVATE_KEY
acf5543f654819bdcb000f7a0e399f9e0b175d52
51
v2_extractor_at_anchor
yezz123/authx
acf5543f654819bdcb000f7a0e399f9e0b175d52
51
train
train
tests/test_config.py
test_bad_algorithm_config_exception
pytest.raises
variable
21
import pytest from authx import AuthXConfig from authx.exceptions import BadConfigurationError def config() -> AuthXConfig: config = AuthXConfig() config.JWT_ALGORITHM = "HS256" config.JWT_SECRET_KEY = "4321J4OP3JIB12BJ4NKJF2EBJE2" config.JWT_TOKEN_LOCATION = ["headers", "cookies", "json", "query"] ...
BadConfigurationError)
acf5543f654819bdcb000f7a0e399f9e0b175d52
51
v2_extractor_at_anchor
yezz123/authx
acf5543f654819bdcb000f7a0e399f9e0b175d52
51
train
train
tests/test_core.py
test_get_token_from_query
assert
none_literal
96
import json from typing import Any, Coroutine, Dict, List import pytest from fastapi import Request from authx import AuthXConfig from authx.core import ( _get_token_from_cookies, _get_token_from_headers, _get_token_from_json, _get_token_from_query, _get_token_from_request, ) from authx.exceptions...
None
acf5543f654819bdcb000f7a0e399f9e0b175d52
51
v2_extractor_at_anchor
yezz123/authx
acf5543f654819bdcb000f7a0e399f9e0b175d52
51
train
train
tests/test_core.py
test_get_token_from_json_post
assert
string_literal
103
import json from typing import Any, Coroutine, Dict, List import pytest from fastapi import Request from authx import AuthXConfig from authx.core import ( _get_token_from_cookies, _get_token_from_headers, _get_token_from_json, _get_token_from_query, _get_token_from_request, ) from authx.exceptions...
"json"
acf5543f654819bdcb000f7a0e399f9e0b175d52
51
v2_extractor_at_anchor
yezz123/authx
acf5543f654819bdcb000f7a0e399f9e0b175d52
51
train
train
tests/test_dependencies.py
test_authx_dependency_methods
assert
variable
15
from unittest.mock import Mock from fastapi import Response from authx import AuthXDependency async def test_authx_dependency_methods(): authx = MockAuthX() request = Mock(scope={"type": "http"}) response = Mock(spec=Response) authx_dependency = AuthXDependency(authx, request, response) assert...
request
acf5543f654819bdcb000f7a0e399f9e0b175d52
51
v2_extractor_at_anchor
yezz123/authx
acf5543f654819bdcb000f7a0e399f9e0b175d52
51
train
train
tests/test_dependencies.py
test_authx_dependency_methods
assert
variable
16
from unittest.mock import Mock from fastapi import Response from authx import AuthXDependency async def test_authx_dependency_methods(): authx = MockAuthX() request = Mock(scope={"type": "http"}) response = Mock(spec=Response) authx_dependency = AuthXDependency(authx, request, response) assert ...
response
acf5543f654819bdcb000f7a0e399f9e0b175d52
51
v2_extractor_at_anchor