repo_id stringclasses 409
values | prefix large_stringlengths 34 36.3k | target large_stringlengths 1 498 | assertion_type stringclasses 31
values | difficulty stringclasses 8
values | test_file stringlengths 10 121 | test_function stringlengths 1 104 | test_class stringlengths 0 51 | lineno int32 2 11.3k | commit_idx int32 |
|---|---|---|---|---|---|---|---|---|---|
wee-slack/wee-slack | from __future__ import annotations
from typing import TYPE_CHECKING, List
import pytest
from slack.shared import shared
from slack.slack_message import SlackMessage
from tests.conftest import (
color_default,
user_test1_id,
user_test2_id,
)
@pytest.mark.parametrize("case", cases)
def test_create_reactio... | case["rendered"] | assert | complex_expr | tests/test_render_reactions.py | test_create_reactions_string | 73 | null | |
wee-slack/wee-slack | from __future__ import print_function, unicode_literals
from wee_slack import SlackTS
def test_slackts():
base = SlackTS("1485976156.000017")
b = SlackTS("1485976156.000016")
c = SlackTS("1485976156.000018")
d = SlackTS("1485976155.000017")
e = SlackTS("1485976157.000017")
assert base > b
... | c | assert | variable | _pytest/test_slackts.py | test_slackts | 16 | null | |
wee-slack/wee-slack | from __future__ import print_function, unicode_literals
from wee_slack import EventRouter
def test_EventRouter(mock_weechat):
# Sending valid object adds to the queue.
e = EventRouter()
e.receive({})
assert len(e.queue) == | 1 | assert | numeric_literal | _pytest/test_eventrouter.py | test_EventRouter | 10 | null | |
wee-slack/wee-slack | from __future__ import print_function, unicode_literals
import wee_slack
from wee_slack import parse_topic_command, topic_command_cb
from mock import patch
def test_parse_topic_with_text():
channel_name, topic = parse_topic_command("/topic some topic text")
assert channel_name is None
assert topic == | "some topic text" | assert | string_literal | _pytest/test_topic_command.py | test_parse_topic_with_text | 19 | null | |
wee-slack/wee-slack | from __future__ import annotations
from itertools import accumulate
from slack.commands import parse_options
from slack.shared import shared
def test_parse_options_with_option_first():
pos_args, options = parse_options("-option1 arg1", options_only_first=False)
assert pos_args == | "arg1" | assert | string_literal | tests/test_commands.py | test_parse_options_with_option_first | 26 | null | |
wee-slack/wee-slack | from __future__ import print_function, unicode_literals
import sys
from collections import OrderedDict
from wee_slack import decode_from_utf8, encode_to_utf8, utf8_decode
b_ae = "æ".encode("utf-8")
b_oe = "ø".encode("utf-8")
b_aa = "å".encode("utf-8")
b_word = b_ae + b_oe + b_aa
def test_decode_preserves_string_... | decode_from_utf8(b"test") | assert | func_call | _pytest/test_utf8_helpers.py | test_decode_preserves_string_without_utf8 | 33 | null | |
wee-slack/wee-slack | from __future__ import annotations
from unittest.mock import MagicMock, patch
import pytest
import weechat
import slack.http
from slack.http import hook_process_hashtable
from slack.task import FutureProcess, FutureTimer, weechat_task_cb
from slack.util import get_callback_name
@patch.object(weechat, "hook_process_... | future_1.id) | assert_* | complex_expr | tests/test_hook_process_hashtable.py | test_hook_process_hashtable_chunked | 43 | null | |
wee-slack/wee-slack | from __future__ import print_function, unicode_literals
import wee_slack
from wee_slack import parse_topic_command, topic_command_cb
from mock import patch
def test_call_topic_with_unknown_channel(realish_eventrouter, team, channel_general):
current_buffer = channel_general.channel_buffer
wee_slack.EVENTROUTE... | "#nonexisting: No such channel") | assert_* | string_literal | _pytest/test_topic_command.py | test_call_topic_with_unknown_channel | 82 | null | |
wee-slack/wee-slack | from __future__ import annotations
from collections import defaultdict
from slack.shared import shared
from slack.task import Future, create_task, weechat_task_cb
def test_run_single_task():
shared.active_tasks = defaultdict(list)
shared.active_futures = {}
future = Future[str]()
async def awaitable... | ("awaitable", ("data",)) | assert | collection | tests/test_task_runner.py | test_run_single_task | 23 | null | |
wee-slack/wee-slack | from __future__ import print_function, unicode_literals
import re
from wee_slack import linkify_text
def test_linkifytext_at_everyone(team):
text = linkify_text("@everyone: my test message", team)
assert text == | "<!everyone>: my test message" | assert | string_literal | _pytest/test_linkifytext.py | test_linkifytext_at_everyone | 65 | null | |
wee-slack/wee-slack | from __future__ import print_function, unicode_literals
import sys
from collections import OrderedDict
from wee_slack import decode_from_utf8, encode_to_utf8, utf8_decode
b_ae = "æ".encode("utf-8")
b_oe = "ø".encode("utf-8")
b_aa = "å".encode("utf-8")
b_word = b_ae + b_oe + b_aa
def test_encode_should_not_transf... | encode_to_utf8(b_word) | assert | func_call | _pytest/test_utf8_helpers.py | test_encode_should_not_transform_bytes | 28 | null | |
wee-slack/wee-slack | from __future__ import print_function, unicode_literals
import json
def test_process_subteam_created(realish_eventrouter, team):
assert len(team.subteams) == | 1 | assert | numeric_literal | _pytest/test_processsubteamcreated.py | test_process_subteam_created | 7 | null | |
wee-slack/wee-slack | from __future__ import print_function, unicode_literals
import sys
from collections import OrderedDict
from wee_slack import decode_from_utf8, encode_to_utf8, utf8_decode
b_ae = "æ".encode("utf-8")
b_oe = "ø".encode("utf-8")
b_aa = "å".encode("utf-8")
b_word = b_ae + b_oe + b_aa
def test_utf8_decode():
a... | decode_from_utf8(args) | assert | func_call | _pytest/test_utf8_helpers.py | test_utf8_decode | 96 | null | |
wee-slack/wee-slack | from __future__ import print_function, unicode_literals
import wee_slack
from wee_slack import parse_topic_command, topic_command_cb
from mock import patch
def test_parse_topic_with_text_with_newline():
channel_name, topic = parse_topic_command("/topic some topic text\nsecond line")
assert channel_name is No... | "some topic text\nsecond line" | assert | string_literal | _pytest/test_topic_command.py | test_parse_topic_with_text_with_newline | 26 | null | |
wee-slack/wee-slack | from __future__ import print_function, unicode_literals
import json
from wee_slack import SlackTS
def test_process_message(realish_eventrouter, team, user_alice):
messages = []
messages.append(
json.loads(
open("_pytest/data/websocket/1485975421.33-message.json", "r").read()
)
... | "hi bob" | assert | string_literal | _pytest/test_process_message.py | test_process_message | 54 | null | |
wee-slack/wee-slack | from __future__ import print_function, unicode_literals
import sys
from collections import OrderedDict
from wee_slack import decode_from_utf8, encode_to_utf8, utf8_decode
b_ae = "æ".encode("utf-8")
b_oe = "ø".encode("utf-8")
b_aa = "å".encode("utf-8")
b_word = b_ae + b_oe + b_aa
def test_decode_should_not_transf... | decode_from_utf8(b_word) | assert | func_call | _pytest/test_utf8_helpers.py | test_decode_should_not_transform_bytes | 22 | null | |
wee-slack/wee-slack | from __future__ import print_function, unicode_literals
import re
from wee_slack import linkify_text
def test_linkifytext_not_private_using_hash(team, channel_private):
channel_name = re.sub(r"^[#&]", "", channel_private.name)
text = linkify_text("#{}: my test message".format(channel_name), team)
asser... | "#{}: my test message".format(channel_name) | assert | string_literal | _pytest/test_linkifytext.py | test_linkifytext_not_private_using_hash | 91 | null | |
wee-slack/wee-slack | from __future__ import annotations
from itertools import accumulate
from slack.commands import parse_options
from slack.shared import shared
def test_parse_options_with_option_first_only_first():
pos_args, options = parse_options("-option1 -option2 arg1", options_only_first=True)
assert pos_args == "arg1"
... | {"option1": True, "option2": True} | assert | collection | tests/test_commands.py | test_parse_options_with_option_first_only_first | 59 | null | |
wee-slack/wee-slack | from __future__ import print_function, unicode_literals
import pytest
import re
import wee_slack
@pytest.mark.parametrize(
"text",
[
"""
* an item
* another item
""",
"* Run this command: `find . -name '*.exe'`",
],
)
def test_does_not_format(realish_eventrouter, text):
a... | text | assert | variable | _pytest/test_formatting.py | test_does_not_format | 20 | null | |
wee-slack/wee-slack | from __future__ import print_function, unicode_literals
import sys
from collections import OrderedDict
from wee_slack import decode_from_utf8, encode_to_utf8, utf8_decode
b_ae = "æ".encode("utf-8")
b_oe = "ø".encode("utf-8")
b_aa = "å".encode("utf-8")
b_word = b_ae + b_oe + b_aa
def test_decode_should_not_transf... | decode_from_utf8("æøå") | assert | func_call | _pytest/test_utf8_helpers.py | test_decode_should_not_transform_str | 19 | null | |
wee-slack/wee-slack | from __future__ import print_function, unicode_literals
from wee_slack import SlackTS
def test_process_reply(realish_eventrouter, team, channel_general):
message_ts = SlackTS("12341234.123456")
message_text = "reply test"
channel_general.send_message(message_text)
team.ws.add(
{"ok": True, "re... | message_text | assert | variable | _pytest/test_processreply.py | test_process_reply | 19 | null | |
wee-slack/wee-slack | from __future__ import annotations
from unittest.mock import MagicMock, patch
import pytest
import weechat
import slack.http
from slack.http import hook_process_hashtable
from slack.task import FutureProcess, FutureTimer, weechat_task_cb
from slack.util import get_callback_name
@patch.object(weechat, "hook_process_... | (command, 0, "out", "err") | assert | collection | tests/test_hook_process_hashtable.py | test_hook_process_hashtable | 30 | null | |
wee-slack/wee-slack | from __future__ import print_function, unicode_literals
import glob
import json
def test_everything(realish_eventrouter, team):
datafiles = glob.glob("_pytest/data/websocket/*.json")
for fname in sorted(datafiles):
data = json.loads(open(fname, "r").read())
team.ws.add(data)
realish_e... | 20 | assert | numeric_literal | _pytest/test_everything.py | test_everything | 16 | null | |
wee-slack/wee-slack | from __future__ import annotations
from collections import defaultdict
from slack.shared import shared
from slack.task import Future, create_task, weechat_task_cb
def test_run_two_tasks_concurrently():
shared.active_tasks = defaultdict(list)
shared.active_futures = {}
future1 = Future[str]()
future2 ... | ("awaitable", ("data1",)) | assert | collection | tests/test_task_runner.py | test_run_two_tasks_concurrently | 64 | null | |
wee-slack/wee-slack | from __future__ import annotations
from textwrap import dedent
from unittest.mock import MagicMock, patch
import pytest
import weechat
from slack.http import HttpError, http_request, http_request_process, http_request_url
from slack.task import FutureProcess, FutureTimer, FutureUrl, weechat_task_cb
from slack.util i... | None | assert | none_literal | tests/test_http_request.py | test_http_request_url_error | 79 | null | |
wee-slack/wee-slack | from __future__ import print_function, unicode_literals
import sys
from collections import OrderedDict
from wee_slack import decode_from_utf8, encode_to_utf8, utf8_decode
b_ae = "æ".encode("utf-8")
b_oe = "ø".encode("utf-8")
b_aa = "å".encode("utf-8")
b_word = b_ae + b_oe + b_aa
def test_decodes_utf8_list_to_uni... | decode_from_utf8([b_ae, b_oe, b_aa]) | assert | func_call | _pytest/test_utf8_helpers.py | test_decodes_utf8_list_to_unicode | 57 | null | |
wee-slack/wee-slack | from __future__ import annotations
from unittest.mock import MagicMock, patch
import pytest
import weechat
from slack.task import FutureTimer, sleep, weechat_task_cb
from slack.util import get_callback_name
@patch.object(weechat, "hook_timer")
def test_sleep(mock_method: MagicMock):
milliseconds = 123
corou... | (0,) | assert | collection | tests/test_sleep.py | test_sleep | 26 | null | |
wee-slack/wee-slack | from __future__ import print_function, unicode_literals
import re
from wee_slack import linkify_text
def test_linkifytext_names_with_apostrophe(team):
text = linkify_text("@O'Connor: my test message", team)
assert text == | "@O'Connor: my test message" | assert | string_literal | _pytest/test_linkifytext.py | test_linkifytext_names_with_apostrophe | 43 | null | |
wee-slack/wee-slack | from __future__ import print_function, unicode_literals
import re
from wee_slack import linkify_text
def test_linkifytext_at_group(team):
text = linkify_text("@group: my test message", team)
assert text == | "<!group>: my test message" | assert | string_literal | _pytest/test_linkifytext.py | test_linkifytext_at_group | 71 | null | |
wee-slack/wee-slack | from __future__ import annotations
from unittest.mock import MagicMock, patch
import pytest
import weechat
import slack.http
from slack.http import hook_process_hashtable
from slack.task import FutureProcess, FutureTimer, weechat_task_cb
from slack.util import get_callback_name
@patch.object(weechat, "hook_process_... | future.id) | assert_* | complex_expr | tests/test_hook_process_hashtable.py | test_hook_process_hashtable | 24 | null | |
fastapi-users/fastapi-users | from datetime import datetime
import pytest
from fastapi_users.authentication.strategy import RedisStrategy
from tests.conftest import IDType, UserModel
def redis() -> RedisMock:
return RedisMock()
def redis_strategy(redis):
return RedisStrategy(redis, 3600)
@pytest.mark.authentication
@pytest.mark.asyncio... | str(user.id) | assert | func_call | tests/test_authentication_strategy_redis.py | test_write_token | 110 | null | |
fastapi-users/fastapi-users | import uuid
from collections.abc import Callable
import pytest
from fastapi.security import OAuth2PasswordRequestForm
from pytest_mock import MockerFixture
from fastapi_users.exceptions import (
InvalidID,
InvalidPasswordException,
InvalidResetPasswordToken,
InvalidVerifyToken,
UserAlreadyExists,
... | 2 | assert | numeric_literal | tests/test_manager.py | test_existing_user_with_oauth | TestOAuthCallback | 191 | null |
fastapi-users/fastapi-users | import pytest
from fastapi_users.authentication.strategy import (
JWTStrategy,
StrategyDestroyNotSupportedError,
)
from fastapi_users.jwt import SecretType, decode_jwt, generate_jwt
from tests.conftest import IDType, UserModel
LIFETIME = 3600
ECC_PRIVATE_KEY = """-----BEGIN PRIVATE KEY-----
MIGHAgEAMBMGByqGS... | user.id | assert | complex_expr | tests/test_authentication_strategy_jwt.py | test_valid_token | TestReadToken | 136 | null |
fastapi-users/fastapi-users | import dataclasses
import uuid
from datetime import datetime, timezone
from typing import Any
import pytest
from fastapi_users.authentication.strategy import (
AccessTokenDatabase,
AccessTokenProtocol,
DatabaseStrategy,
)
from tests.conftest import IDType, UserModel
def access_token_database() -> AccessT... | user.id | assert | complex_expr | tests/test_authentication_strategy_db.py | test_write_token | 135 | null | |
fastapi-users/fastapi-users | from typing import Any, cast
import httpx
import pytest
import pytest_asyncio
from fastapi import FastAPI, status
from httpx_oauth.oauth2 import BaseOAuth2, OAuth2
from fastapi_users import exceptions
from fastapi_users.authentication import AuthenticationBackend, Authenticator
from fastapi_users.router.common import... | "/oauth/authorize" | assert | string_literal | tests/test_router_oauth.py | test_route_names | 765 | null | |
fastapi-users/fastapi-users | from collections.abc import AsyncGenerator
from typing import Any, cast
import httpx
import pytest
import pytest_asyncio
from fastapi import FastAPI, status
from fastapi_users.exceptions import (
InvalidPasswordException,
InvalidResetPasswordToken,
UserInactive,
UserNotExists,
)
from fastapi_users.rou... | "/reset-password" | assert | string_literal | tests/test_router_reset.py | test_reset_password_namespace | 165 | null | |
fastapi-users/fastapi-users | from typing import Any, cast
import httpx
import pytest
import pytest_asyncio
from fastapi import FastAPI, status
from httpx_oauth.oauth2 import BaseOAuth2, OAuth2
from fastapi_users import exceptions
from fastapi_users.authentication import AuthenticationBackend, Authenticator
from fastapi_users.router.common import... | data | assert | variable | tests/test_router_oauth.py | test_success | TestAuthorize | 108 | null |
fastapi-users/fastapi-users | from collections.abc import AsyncGenerator
from typing import Any, cast
import httpx
import pytest
import pytest_asyncio
from fastapi import FastAPI, status
from fastapi_users.authentication import Authenticator
from fastapi_users.router import ErrorCode, get_users_router
from tests.conftest import User, UserModel, U... | b"" | assert | string_literal | tests/test_router_users.py | test_verified_superuser | TestDeleteUser | 957 | null |
fastapi-users/fastapi-users | from collections.abc import AsyncGenerator
from typing import Any, cast
import httpx
import pytest
import pytest_asyncio
from fastapi import FastAPI, status
from fastapi_users.authentication import Authenticator
from fastapi_users.router import ErrorCode, get_users_router
from tests.conftest import User, UserModel, U... | data | assert | variable | tests/test_router_users.py | test_verified_superuser | TestGetUser | 484 | null |
fastapi-users/fastapi-users | import re
import pytest
from fastapi import Response, status
from fastapi_users.authentication.transport import CookieTransport
COOKIE_MAX_AGE = 3600
COOKIE_NAME = "COOKIE_NAME"
def cookie_transport(request) -> CookieTransport:
path, domain, secure, httponly = request.param
return CookieTransport(
c... | { status.HTTP_204_NO_CONTENT: {"model": None} } | assert | collection | tests/test_authentication_transport_cookie.py | test_get_openapi_login_responses_success | 98 | null | |
fastapi-users/fastapi-users | from collections.abc import AsyncGenerator
from typing import Any, cast
import httpx
import pytest
import pytest_asyncio
from fastapi import FastAPI, status
from fastapi_users.exceptions import (
InvalidPasswordException,
InvalidResetPasswordToken,
UserInactive,
UserNotExists,
)
from fastapi_users.rou... | status.HTTP_202_ACCEPTED | assert | complex_expr | tests/test_router_reset.py | test_not_existing_user | TestForgotPassword | 48 | null |
fastapi-users/fastapi-users | from collections.abc import AsyncGenerator
from typing import Any, cast
import httpx
import pytest
import pytest_asyncio
from fastapi import FastAPI, status
from fastapi_users.exceptions import (
InvalidVerifyToken,
UserAlreadyVerified,
UserInactive,
UserNotExists,
)
from fastapi_users.router import E... | False | assert | bool_literal | tests/test_router_verify.py | test_empty_body | TestVerifyTokenRequest | 43 | null |
fastapi-users/fastapi-users | from collections.abc import AsyncGenerator
from typing import Any, cast
import httpx
import pytest
import pytest_asyncio
from fastapi import FastAPI, status
from fastapi_users.router import ErrorCode, get_register_router
from tests.conftest import User, UserCreate
class TestRegister:
@pytest.mark.parametrize("e... | status.HTTP_201_CREATED | assert | complex_expr | tests/test_router_register.py | test_valid_body | TestRegister | 76 | null |
fastapi-users/fastapi-users | import pytest
from fastapi import status
from fastapi.responses import JSONResponse
from fastapi_users.authentication.transport import (
BearerTransport,
TransportLogoutNotSupportedError,
)
from fastapi_users.authentication.transport.bearer import BearerResponse
def bearer_transport() -> BearerTransport:
... | {} | assert | collection | tests/test_authentication_transport_bearer.py | test_get_openapi_logout_responses_success | 44 | null | |
fastapi-users/fastapi-users | import pytest
from fastapi_users.jwt import SecretType, decode_jwt, generate_jwt
@pytest.mark.jwt
def test_generate_decode_jwt(secret: SecretType):
audience = "TEST_AUDIENCE"
data = {"foo": "bar", "aud": audience}
jwt = generate_jwt(data, secret, 3600)
decoded = decode_jwt(jwt, secret, [audience])
... | "bar" | assert | string_literal | tests/test_jwt.py | test_generate_decode_jwt | 14 | null | |
fastapi-users/fastapi-users | from collections.abc import AsyncGenerator
from typing import Any, cast
import httpx
import pytest
import pytest_asyncio
from fastapi import FastAPI, status
from fastapi_users.router import ErrorCode, get_register_router
from tests.conftest import User, UserCreate
class TestRegister:
async def test_empty_body(se... | status.HTTP_422_UNPROCESSABLE_CONTENT | assert | complex_expr | tests/test_router_register.py | test_empty_body | TestRegister | 35 | null |
fastapi-users/fastapi-users | from collections.abc import AsyncGenerator
from typing import Any, cast
import httpx
import pytest
import pytest_asyncio
from fastapi import FastAPI, status
from fastapi_users.exceptions import (
InvalidPasswordException,
InvalidResetPasswordToken,
UserInactive,
UserNotExists,
)
from fastapi_users.rou... | "/forgot-password" | assert | string_literal | tests/test_router_reset.py | test_forgot_password_namespace | 158 | null | |
fastapi-users/fastapi-users | from collections.abc import AsyncGenerator
from typing import Any, cast
import httpx
import pytest
import pytest_asyncio
from fastapi import FastAPI, status
from fastapi_users.authentication import Authenticator
from fastapi_users.router import ErrorCode, get_auth_router
from tests.conftest import UserModel, get_mock... | True | assert | bool_literal | tests/test_router_auth.py | test_valid_credentials_verified | TestLogin | 168 | null |
fastapi-users/fastapi-users | from collections.abc import AsyncGenerator
from typing import Any, cast
import httpx
import pytest
import pytest_asyncio
from fastapi import FastAPI, status
from fastapi_users.authentication import Authenticator
from fastapi_users.router import ErrorCode, get_auth_router
from tests.conftest import UserModel, get_mock... | status.HTTP_403_FORBIDDEN | assert | complex_expr | tests/test_router_auth.py | test_valid_credentials_unverified | TestLogout | 213 | null |
fastapi-users/fastapi-users | from collections.abc import AsyncGenerator
from typing import Any, cast
import httpx
import pytest
import pytest_asyncio
from fastapi import FastAPI, status
from fastapi_users.authentication import Authenticator
from fastapi_users.router import ErrorCode, get_auth_router
from tests.conftest import UserModel, get_mock... | "/mock/logout" | assert | string_literal | tests/test_router_auth.py | test_route_names | 239 | null | |
fastapi-users/fastapi-users | import re
import pytest
from fastapi import Response, status
from fastapi_users.authentication.transport import CookieTransport
COOKIE_MAX_AGE = 3600
COOKIE_NAME = "COOKIE_NAME"
def cookie_transport(request) -> CookieTransport:
path, domain, secure, httponly = request.param
return CookieTransport(
c... | status.HTTP_204_NO_CONTENT | assert | complex_expr | tests/test_authentication_transport_cookie.py | test_get_logout_response | 85 | null | |
fastapi-users/fastapi-users | from collections.abc import AsyncGenerator
import httpx
import pytest
import pytest_asyncio
from fastapi import Depends, FastAPI, status
from fastapi_users import FastAPIUsers
from tests.conftest import IDType, User, UserCreate, UserModel, UserUpdate
class TestOptionalGetCurrentUser:
async def test_missing_token... | None | assert | none_literal | tests/test_fastapi_users.py | test_missing_token | TestOptionalGetCurrentUser | 324 | null |
fastapi-users/fastapi-users | from typing import Any, cast
import httpx
import pytest
import pytest_asyncio
from fastapi import FastAPI, status
from httpx_oauth.oauth2 import BaseOAuth2, OAuth2
from fastapi_users import exceptions
from fastapi_users.authentication import AuthenticationBackend, Authenticator
from fastapi_users.router.common import... | status.HTTP_200_OK | assert | complex_expr | tests/test_router_oauth.py | test_success | TestAuthorize | 104 | null |
fastapi-users/fastapi-users | from datetime import datetime
import pytest
from fastapi_users.authentication.strategy import RedisStrategy
from tests.conftest import IDType, UserModel
def redis() -> RedisMock:
return RedisMock()
def redis_strategy(redis):
return RedisStrategy(redis, 3600)
@pytest.mark.authentication
@pytest.mark.asyncio... | None | assert | none_literal | tests/test_authentication_strategy_redis.py | test_destroy_token | 122 | null | |
fastapi-users/fastapi-users | from collections.abc import AsyncGenerator
from typing import Any, cast
import httpx
import pytest
import pytest_asyncio
from fastapi import FastAPI, status
from fastapi_users.router import ErrorCode, get_register_router
from tests.conftest import User, UserCreate
class TestRegister:
@pytest.mark.parametrize("e... | data | assert | variable | tests/test_router_register.py | test_valid_body | TestRegister | 79 | null |
fastapi-users/fastapi-users | from typing import Any, cast
import httpx
import pytest
import pytest_asyncio
from fastapi import FastAPI, status
from httpx_oauth.oauth2 import BaseOAuth2, OAuth2
from fastapi_users import exceptions
from fastapi_users.authentication import AuthenticationBackend, Authenticator
from fastapi_users.router.common import... | None | assert | none_literal | tests/test_router_oauth.py | test_success | TestAuthorize | 110 | null |
fastapi-users/fastapi-users | from collections.abc import AsyncGenerator
from typing import Any, cast
import httpx
import pytest
import pytest_asyncio
from fastapi import FastAPI, status
from fastapi_users.router import ErrorCode, get_register_router
from tests.conftest import User, UserCreate
class TestRegister:
@pytest.mark.parametrize("e... | None | assert | none_literal | tests/test_router_register.py | test_valid_body | TestRegister | 81 | null |
fastapi-users/fastapi-users | from collections.abc import AsyncGenerator
from typing import Any, cast
import httpx
import pytest
import pytest_asyncio
from fastapi import FastAPI, status
from fastapi_users.exceptions import (
InvalidVerifyToken,
UserAlreadyVerified,
UserInactive,
UserNotExists,
)
from fastapi_users.router import E... | str(user.id) | assert | func_call | tests/test_router_verify.py | test_success | TestVerify | 179 | null |
fastapi-users/fastapi-users | import httpx
import pytest
import pytest_asyncio
from fastapi import FastAPI, status
from fastapi_users.fastapi_users import FastAPIUsers
from tests.conftest import IDType, User, UserCreate, UserModel, UserUpdate
def fastapi_users(get_user_manager, mock_authentication) -> FastAPIUsers:
return FastAPIUsers[UserMod... | ["200", "422"] | assert | collection | tests/test_openapi.py | test_oauth_authorize_status_codes | TestOAuth2 | 108 | null |
fastapi-users/fastapi-users | from collections.abc import AsyncGenerator
from typing import Any, cast
import httpx
import pytest
import pytest_asyncio
from fastapi import FastAPI, status
from fastapi_users.exceptions import (
InvalidVerifyToken,
UserAlreadyVerified,
UserInactive,
UserNotExists,
)
from fastapi_users.router import E... | "/request-verify-token" | assert | string_literal | tests/test_router_verify.py | test_token_namespace | TestVerifyTokenRequest | 116 | null |
fastapi-users/fastapi-users | from collections.abc import AsyncGenerator
from typing import Any, cast
import httpx
import pytest
import pytest_asyncio
from fastapi import FastAPI, status
from fastapi_users.router import ErrorCode, get_register_router
from tests.conftest import User, UserCreate
class TestRegister:
@pytest.mark.parametrize(
... | ErrorCode.REGISTER_USER_ALREADY_EXISTS | assert | complex_expr | tests/test_router_register.py | test_existing_user | TestRegister | 70 | null |
fastapi-users/fastapi-users | from collections.abc import AsyncGenerator
from typing import Any, cast
import httpx
import pytest
import pytest_asyncio
from fastapi import FastAPI, status
from fastapi_users.router import ErrorCode, get_register_router
from tests.conftest import User, UserCreate
class TestRegister:
async def test_invalid_pass... | status.HTTP_400_BAD_REQUEST | assert | complex_expr | tests/test_router_register.py | test_invalid_password | TestRegister | 55 | null |
fastapi-users/fastapi-users | import uuid
from collections.abc import Callable
import pytest
from fastapi.security import OAuth2PasswordRequestForm
from pytest_mock import MockerFixture
from fastapi_users.exceptions import (
InvalidID,
InvalidPasswordException,
InvalidResetPasswordToken,
InvalidVerifyToken,
UserAlreadyExists,
... | 1 | assert | numeric_literal | tests/test_manager.py | test_existing_user_without_oauth_associate | TestOAuthCallback | 215 | null |
fastapi-users/fastapi-users | from collections.abc import AsyncGenerator
from typing import Any, cast
import httpx
import pytest
import pytest_asyncio
from fastapi import FastAPI, status
from fastapi_users.router import ErrorCode, get_register_router
from tests.conftest import User, UserCreate
class TestRegister:
async def test_valid_body_i... | False | assert | bool_literal | tests/test_router_register.py | test_valid_body_is_superuser | TestRegister | 93 | null |
fastapi-users/fastapi-users | import pytest
from fastapi_users.authentication.strategy import (
JWTStrategy,
StrategyDestroyNotSupportedError,
)
from fastapi_users.jwt import SecretType, decode_jwt, generate_jwt
from tests.conftest import IDType, UserModel
LIFETIME = 3600
ECC_PRIVATE_KEY = """-----BEGIN PRIVATE KEY-----
MIGHAgEAMBMGByqGS... | None | assert | none_literal | tests/test_authentication_strategy_jwt.py | test_missing_token | TestReadToken | 98 | null |
fastapi-users/fastapi-users | import uuid
import pytest
from fastapi_users.db import BaseUserDatabase
from tests.conftest import IDType, OAuthAccountModel, UserModel
@pytest.mark.asyncio
@pytest.mark.db
async def test_not_implemented_methods(
user: UserModel, oauth_account1: OAuthAccountModel
):
base_user_db = BaseUserDatabase[UserModel,... | NotImplementedError) | pytest.raises | variable | tests/test_db_base.py | test_not_implemented_methods | 16 | null | |
fastapi-users/fastapi-users | from collections.abc import AsyncGenerator
from typing import Any, cast
import httpx
import pytest
import pytest_asyncio
from fastapi import FastAPI, status
from fastapi_users.exceptions import (
InvalidVerifyToken,
UserAlreadyVerified,
UserInactive,
UserNotExists,
)
from fastapi_users.router import E... | status.HTTP_400_BAD_REQUEST | assert | complex_expr | tests/test_router_verify.py | test_user_not_exists | TestVerify | 151 | null |
fastapi-users/fastapi-users | import httpx
import pytest
import pytest_asyncio
from fastapi import FastAPI, status
from fastapi_users.fastapi_users import FastAPIUsers
from tests.conftest import IDType, User, UserCreate, UserModel, UserUpdate
def fastapi_users(get_user_manager, mock_authentication) -> FastAPIUsers:
return FastAPIUsers[UserMod... | ["202", "422"] | assert | collection | tests/test_openapi.py | test_forgot_password_status_codes | TestReset | 57 | null |
fastapi-users/fastapi-users | from collections.abc import AsyncGenerator
from typing import Any, cast
import httpx
import pytest
import pytest_asyncio
from fastapi import FastAPI, status
from fastapi_users.exceptions import (
InvalidPasswordException,
InvalidResetPasswordToken,
UserInactive,
UserNotExists,
)
from fastapi_users.rou... | status.HTTP_200_OK | assert | complex_expr | tests/test_router_reset.py | test_valid_user_password | TestResetPassword | 151 | null |
fastapi-users/fastapi-users | from collections.abc import AsyncGenerator, Sequence
from typing import Generic
import httpx
import pytest
import pytest_asyncio
from fastapi import Depends, FastAPI, Request, status
from fastapi.security.base import SecurityBase
from fastapi_users import models
from fastapi_users.authentication import Authentication... | status.HTTP_200_OK | assert | complex_expr | tests/test_authentication_authenticator.py | test_authenticator | 122 | null | |
fastapi-users/fastapi-users | import uuid
from collections.abc import Callable
import pytest
from fastapi.security import OAuth2PasswordRequestForm
from pytest_mock import MockerFixture
from fastapi_users.exceptions import (
InvalidID,
InvalidPasswordException,
InvalidResetPasswordToken,
InvalidVerifyToken,
UserAlreadyExists,
... | None | assert | none_literal | tests/test_manager.py | test_existing_user_without_oauth_associate | TestOAuthCallback | 216 | null |
fastapi-users/fastapi-users | from collections.abc import AsyncGenerator
from typing import Any, cast
import httpx
import pytest
import pytest_asyncio
from fastapi import FastAPI, status
from fastapi_users.exceptions import (
InvalidVerifyToken,
UserAlreadyVerified,
UserInactive,
UserNotExists,
)
from fastapi_users.router import E... | "/verify" | assert | string_literal | tests/test_router_verify.py | test_verify_namespace | TestVerify | 192 | null |
fastapi-users/fastapi-users | from collections.abc import AsyncGenerator
from typing import Any, cast
import httpx
import pytest
import pytest_asyncio
from fastapi import FastAPI, status
from fastapi_users.authentication import Authenticator
from fastapi_users.router import ErrorCode, get_auth_router
from tests.conftest import UserModel, get_mock... | "/mock/login" | assert | string_literal | tests/test_router_auth.py | test_route_names | 236 | null | |
fastapi-users/fastapi-users | import httpx
import pytest
import pytest_asyncio
from fastapi import FastAPI, status
from fastapi_users.fastapi_users import FastAPIUsers
from tests.conftest import IDType, User, UserCreate, UserModel, UserUpdate
def fastapi_users(get_user_manager, mock_authentication) -> FastAPIUsers:
return FastAPIUsers[UserMod... | ["204", "401", "403", "404", "422"] | assert | collection | tests/test_openapi.py | test_delete_id_status_codes | TestUsers | 74 | null |
fastapi-users/fastapi-users | from typing import Any, cast
import httpx
import pytest
import pytest_asyncio
from fastapi import FastAPI, status
from httpx_oauth.oauth2 import BaseOAuth2, OAuth2
from fastapi_users import exceptions
from fastapi_users.authentication import AuthenticationBackend, Authenticator
from fastapi_users.router.common import... | True | assert | bool_literal | tests/test_router_oauth.py | test_active_user | TestCallback | 253 | null |
fastapi-users/fastapi-users | from collections.abc import AsyncGenerator
from typing import Any, cast
import httpx
import pytest
import pytest_asyncio
from fastapi import FastAPI, status
from fastapi_users.exceptions import (
InvalidPasswordException,
InvalidResetPasswordToken,
UserInactive,
UserNotExists,
)
from fastapi_users.rou... | status.HTTP_400_BAD_REQUEST | assert | complex_expr | tests/test_router_reset.py | test_inactive_user | TestResetPassword | 121 | null |
fastapi-users/fastapi-users | import pytest
from fastapi_users.authentication.strategy import (
JWTStrategy,
StrategyDestroyNotSupportedError,
)
from fastapi_users.jwt import SecretType, decode_jwt, generate_jwt
from tests.conftest import IDType, UserModel
LIFETIME = 3600
ECC_PRIVATE_KEY = """-----BEGIN PRIVATE KEY-----
MIGHAgEAMBMGByqGS... | StrategyDestroyNotSupportedError) | pytest.raises | variable | tests/test_authentication_strategy_jwt.py | test_destroy_token | 158 | null | |
fastapi-users/fastapi-users | from collections.abc import AsyncGenerator
from typing import Any, cast
import httpx
import pytest
import pytest_asyncio
from fastapi import FastAPI, status
from fastapi_users.exceptions import (
InvalidPasswordException,
InvalidResetPasswordToken,
UserInactive,
UserNotExists,
)
from fastapi_users.rou... | status.HTTP_422_UNPROCESSABLE_CONTENT | assert | complex_expr | tests/test_router_reset.py | test_empty_body | TestForgotPassword | 39 | null |
fastapi-users/fastapi-users | import re
import pytest
from fastapi import Response, status
from fastapi_users.authentication.transport import CookieTransport
COOKIE_MAX_AGE = 3600
COOKIE_NAME = "COOKIE_NAME"
def cookie_transport(request) -> CookieTransport:
path, domain, secure, httponly = request.param
return CookieTransport(
c... | cookie | assert | variable | tests/test_authentication_transport_cookie.py | test_get_login_response | 51 | null | |
fastapi-users/fastapi-users | from collections.abc import AsyncGenerator
from typing import Any, cast
import httpx
import pytest
import pytest_asyncio
from fastapi import FastAPI, status
from fastapi_users.router import ErrorCode, get_register_router
from tests.conftest import User, UserCreate
class TestRegister:
async def test_valid_body_i... | True | assert | bool_literal | tests/test_router_register.py | test_valid_body_is_active | TestRegister | 105 | null |
fastapi-users/fastapi-users | from collections.abc import AsyncGenerator
from typing import Any, cast
import httpx
import pytest
import pytest_asyncio
from fastapi import FastAPI, status
from fastapi_users.authentication import Authenticator
from fastapi_users.router import ErrorCode, get_users_router
from tests.conftest import User, UserModel, U... | False | assert | bool_literal | tests/test_router_users.py | test_unverified_after_email_change | TestUpdateMe | 215 | null |
fastapi-users/fastapi-users | from collections.abc import AsyncGenerator
from typing import Any, cast
import httpx
import pytest
import pytest_asyncio
from fastapi import FastAPI, status
from fastapi_users.exceptions import (
InvalidPasswordException,
InvalidResetPasswordToken,
UserInactive,
UserNotExists,
)
from fastapi_users.rou... | False | assert | bool_literal | tests/test_router_reset.py | test_empty_body | TestForgotPassword | 40 | null |
fastapi-users/fastapi-users | import httpx
import pytest
import pytest_asyncio
from fastapi import FastAPI, status
from fastapi_users.fastapi_users import FastAPIUsers
from tests.conftest import IDType, User, UserCreate, UserModel, UserUpdate
def fastapi_users(get_user_manager, mock_authentication) -> FastAPIUsers:
return FastAPIUsers[UserMod... | ["200", "401", "400", "422"] | assert | collection | tests/test_openapi.py | test_patch_me_status_codes | TestUsers | 82 | null |
fastapi-users/fastapi-users | from collections.abc import AsyncGenerator
from typing import Any, cast
import httpx
import pytest
import pytest_asyncio
from fastapi import FastAPI, status
from fastapi_users.exceptions import (
InvalidVerifyToken,
UserAlreadyVerified,
UserInactive,
UserNotExists,
)
from fastapi_users.router import E... | status.HTTP_200_OK | assert | complex_expr | tests/test_router_verify.py | test_success | TestVerify | 177 | null |
fastapi-users/fastapi-users | from datetime import datetime
import pytest
from fastapi_users.authentication.strategy import RedisStrategy
from tests.conftest import IDType, UserModel
def redis() -> RedisMock:
return RedisMock()
def redis_strategy(redis):
return RedisStrategy(redis, 3600)
class TestReadToken:
@pytest.mark.asyncio
... | user.id | assert | complex_expr | tests/test_authentication_strategy_redis.py | test_valid_token | TestReadToken | 99 | null |
fastapi-users/fastapi-users | from collections.abc import AsyncGenerator
from typing import Any, cast
import httpx
import pytest
import pytest_asyncio
from fastapi import FastAPI, status
from fastapi_users.authentication import Authenticator
from fastapi_users.router import ErrorCode, get_auth_router
from tests.conftest import UserModel, get_mock... | status.HTTP_400_BAD_REQUEST | assert | complex_expr | tests/test_router_auth.py | test_not_existing_user | TestLogin | 105 | null |
fastapi-users/fastapi-users | from collections.abc import AsyncGenerator, Sequence
from typing import Generic
import httpx
import pytest
import pytest_asyncio
from fastapi import Depends, FastAPI, Request, status
from fastapi.security.base import SecurityBase
from fastapi_users import models
from fastapi_users.authentication import Authentication... | DuplicateBackendNamesError) | pytest.raises | variable | tests/test_authentication_authenticator.py | test_authenticators_with_same_name | 156 | null | |
fastapi-users/fastapi-users | from collections.abc import AsyncGenerator, Sequence
from typing import Generic
import httpx
import pytest
import pytest_asyncio
from fastapi import Depends, FastAPI, Request, status
from fastapi.security.base import SecurityBase
from fastapi_users import models
from fastapi_users.authentication import Authentication... | status.HTTP_401_UNAUTHORIZED | assert | complex_expr | tests/test_authentication_authenticator.py | test_authenticator_none | 132 | null | |
fastapi-users/fastapi-users | import httpx
import pytest
import pytest_asyncio
from fastapi import FastAPI, status
from fastapi_users.fastapi_users import FastAPIUsers
from tests.conftest import IDType, User, UserCreate, UserModel, UserUpdate
def fastapi_users(get_user_manager, mock_authentication) -> FastAPIUsers:
return FastAPIUsers[UserMod... | ["201", "400", "422"] | assert | collection | tests/test_openapi.py | test_register_status_codes | TestRegister | 92 | null |
fastapi-users/fastapi-users | from collections.abc import AsyncGenerator
from typing import Any, cast
import httpx
import pytest
import pytest_asyncio
from fastapi import FastAPI, status
from fastapi_users.exceptions import (
InvalidVerifyToken,
UserAlreadyVerified,
UserInactive,
UserNotExists,
)
from fastapi_users.router import E... | ErrorCode.VERIFY_USER_BAD_TOKEN | assert | complex_expr | tests/test_router_verify.py | test_user_not_exists | TestVerify | 153 | null |
fastapi-users/fastapi-users | from collections.abc import AsyncGenerator
from typing import Any, cast
import httpx
import pytest
import pytest_asyncio
from fastapi import FastAPI, status
from fastapi_users.authentication import Authenticator
from fastapi_users.router import ErrorCode, get_users_router
from tests.conftest import User, UserModel, U... | "/me" | assert | string_literal | tests/test_router_users.py | test_current_user_namespace | TestMe | 102 | null |
fastapi-users/fastapi-users | import re
import pytest
from fastapi import Response, status
from fastapi_users.authentication.transport import CookieTransport
COOKIE_MAX_AGE = 3600
COOKIE_NAME = "COOKIE_NAME"
def cookie_transport(request) -> CookieTransport:
path, domain, secure, httponly = request.param
return CookieTransport(
c... | None | assert | none_literal | tests/test_authentication_transport_cookie.py | test_get_login_response | 70 | null | |
fastapi-users/fastapi-users | from collections.abc import AsyncGenerator
from typing import Any, cast
import httpx
import pytest
import pytest_asyncio
from fastapi import FastAPI, status
from fastapi_users.exceptions import (
InvalidVerifyToken,
UserAlreadyVerified,
UserInactive,
UserNotExists,
)
from fastapi_users.router import E... | status.HTTP_422_UNPROCESSABLE_CONTENT | assert | complex_expr | tests/test_router_verify.py | test_empty_body | TestVerifyTokenRequest | 42 | null |
fastapi-users/fastapi-users | import dataclasses
import uuid
from datetime import datetime, timezone
from typing import Any
import pytest
from fastapi_users.authentication.strategy import (
AccessTokenDatabase,
AccessTokenProtocol,
DatabaseStrategy,
)
from tests.conftest import IDType, UserModel
def access_token_database() -> AccessT... | None | assert | none_literal | tests/test_authentication_strategy_db.py | test_write_token | 134 | null | |
fastapi-users/fastapi-users | from collections.abc import AsyncGenerator
from typing import Any, cast
import httpx
import pytest
import pytest_asyncio
from fastapi import FastAPI, status
from fastapi_users.exceptions import (
InvalidVerifyToken,
UserAlreadyVerified,
UserInactive,
UserNotExists,
)
from fastapi_users.router import E... | status.HTTP_202_ACCEPTED | assert | complex_expr | tests/test_router_verify.py | test_user_not_exists | TestVerifyTokenRequest | 63 | null |
fastapi-users/fastapi-users | from collections.abc import AsyncGenerator
from typing import Any, cast
import httpx
import pytest
import pytest_asyncio
from fastapi import FastAPI, status
from fastapi_users.exceptions import (
InvalidPasswordException,
InvalidResetPasswordToken,
UserInactive,
UserNotExists,
)
from fastapi_users.rou... | ErrorCode.RESET_PASSWORD_BAD_TOKEN | assert | complex_expr | tests/test_router_reset.py | test_inactive_user | TestResetPassword | 123 | null |
fastapi-users/fastapi-users | import pytest
from fastapi import status
from fastapi.responses import JSONResponse
from fastapi_users.authentication.transport import (
BearerTransport,
TransportLogoutNotSupportedError,
)
from fastapi_users.authentication.transport.bearer import BearerResponse
def bearer_transport() -> BearerTransport:
... | b'{"access_token":"TOKEN","token_type":"bearer"}' | assert | string_literal | tests/test_authentication_transport_bearer.py | test_get_login_response | 23 | null | |
fastapi-users/fastapi-users | import pytest
from fastapi import status
from fastapi.responses import JSONResponse
from fastapi_users.authentication.transport import (
BearerTransport,
TransportLogoutNotSupportedError,
)
from fastapi_users.authentication.transport.bearer import BearerResponse
def bearer_transport() -> BearerTransport:
... | TransportLogoutNotSupportedError) | pytest.raises | variable | tests/test_authentication_transport_bearer.py | test_get_logout_response | 29 | null | |
fastapi-users/fastapi-users | from collections.abc import AsyncGenerator
from typing import Any, cast
import httpx
import pytest
import pytest_asyncio
from fastapi import FastAPI, status
from fastapi_users.authentication import Authenticator
from fastapi_users.router import ErrorCode, get_auth_router
from tests.conftest import UserModel, get_mock... | 3 | assert | numeric_literal | tests/test_router_auth.py | test_valid_credentials_verified | TestLogin | 170 | null |
fastapi-users/fastapi-users | import pytest
from fastapi_users.jwt import SecretType, decode_jwt, generate_jwt
@pytest.mark.jwt
def test_generate_decode_jwt(secret: SecretType):
audience = "TEST_AUDIENCE"
data = {"foo": "bar", "aud": audience}
jwt = generate_jwt(data, secret, 3600)
decoded = decode_jwt(jwt, secret, [audience])
... | audience | assert | variable | tests/test_jwt.py | test_generate_decode_jwt | 15 | null |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.