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 |
|---|---|---|---|---|---|---|---|---|---|
jazzband/djangorestframework-simplejwt | from datetime import timedelta
from importlib import reload
from unittest.mock import MagicMock, patch
from django.conf import settings
from django.contrib.auth import get_user_model
from django.test import TestCase, override_settings
from rest_framework import exceptions as drf_exceptions
from rest_framework_simplej... | old_jti) | self.assertEqual | variable | tests/test_serializers.py | test_it_should_blacklist_refresh_token_if_tokens_should_be_rotated_and_blacklisted | TestTokenRefreshSerializer | 535 | null |
jazzband/djangorestframework-simplejwt | import builtins
import uuid
from datetime import datetime, timedelta
from importlib import reload
from json import JSONEncoder
from unittest import mock
from unittest.mock import patch
import jwt
import pytest
from django.test import TestCase
from jwt import PyJWS, algorithms
from jwt import __version__ as jwt_version... | TokenBackendExpiredToken) | self.assertRaises | variable | tests/test_backends.py | test_decode_with_expiry | TestTokenBackend | 200 | null |
jazzband/djangorestframework-simplejwt | from datetime import timedelta
from importlib import reload
from django.contrib.auth import get_user_model
from django.test import TestCase
from rest_framework.test import APIRequestFactory
from rest_framework_simplejwt import authentication
from rest_framework_simplejwt.exceptions import AuthenticationFailed, Invali... | InvalidToken) | self.assertRaises | variable | tests/test_authentication.py | test_get_validated_token | TestJWTAuthentication | 92 | null |
jazzband/djangorestframework-simplejwt | from datetime import timedelta
from unittest import mock
from unittest.mock import patch
from django.contrib.auth import get_user_model
from django.utils import timezone
from rest_framework.test import APIRequestFactory
from rest_framework_simplejwt import serializers
from rest_framework_simplejwt.settings import api... | 0) | self.assertEqual | numeric_literal | tests/test_views.py | test_it_should_return_200_if_everything_okay | TestTokenVerifyView | 373 | null |
jazzband/djangorestframework-simplejwt | from importlib import reload
from unittest.mock import patch
from django.contrib.auth.models import User
from django.core.management import call_command
from django.db.models import BigAutoField
from django.test import TestCase
from django.utils import timezone
from rest_framework_simplejwt.exceptions import TokenErr... | 4) | self.assertEqual | numeric_literal | tests/test_token_blacklist.py | test_it_should_delete_any_expired_tokens | TestTokenBlacklistFlushExpiredTokens | 227 | null |
jazzband/djangorestframework-simplejwt | import builtins
import uuid
from datetime import datetime, timedelta
from importlib import reload
from json import JSONEncoder
from unittest import mock
from unittest.mock import patch
import jwt
import pytest
from django.test import TestCase
from jwt import PyJWS, algorithms
from jwt import __version__ as jwt_version... | None) | self.assertEqual | none_literal | tests/test_backends.py | test_jwk_client_not_available | TestTokenBackend | 102 | null |
jazzband/djangorestframework-simplejwt | from importlib import reload
from unittest.mock import patch
from django.test import TestCase
from rest_framework_simplejwt.models import TokenUser
from rest_framework_simplejwt.settings import api_settings
AuthToken = api_settings.AUTH_TOKEN_CLASSES[0]
class TestTokenUser(TestCase):
def setUp(self):
se... | self.user.is_active) | self.assertTrue | complex_expr | tests/test_models.py | test_is_active | TestTokenUser | 37 | null |
jazzband/djangorestframework-simplejwt | from importlib import reload
from unittest.mock import patch
from django.test import TestCase
from rest_framework_simplejwt.models import TokenUser
from rest_framework_simplejwt.settings import api_settings
AuthToken = api_settings.AUTH_TOKEN_CLASSES[0]
class TestTokenUser(TestCase):
def setUp(self):
se... | NotImplementedError) | self.assertRaises | variable | tests/test_models.py | test_not_implemented | TestTokenUser | 88 | null |
jazzband/djangorestframework-simplejwt | from datetime import datetime, timedelta
from importlib import reload
from unittest.mock import patch
from django.contrib.auth import get_user_model
from django.test import TestCase
from freezegun import freeze_time
from jose import jwt
from rest_framework_simplejwt.exceptions import (
ExpiredTokenError,
Toke... | t.token) | self.assertIsNone | complex_expr | tests/test_tokens.py | test_init_no_token_given | TestToken | 89 | null |
jazzband/djangorestframework-simplejwt | import builtins
import uuid
from datetime import datetime, timedelta
from importlib import reload
from json import JSONEncoder
from unittest import mock
from unittest.mock import patch
import jwt
import pytest
from django.test import TestCase
from jwt import PyJWS, algorithms
from jwt import __version__ as jwt_version... | str) | self.assertIsInstance | variable | tests/test_backends.py | test_token_encode_should_return_str_for_old_PyJWT | TestTokenBackend | 108 | null |
jazzband/djangorestframework-simplejwt | from datetime import timedelta
from importlib import reload
from unittest.mock import MagicMock, patch
from django.conf import settings
from django.contrib.auth import get_user_model
from django.test import TestCase, override_settings
from rest_framework import exceptions as drf_exceptions
from rest_framework_simplej... | s.errors) | self.assertIn | complex_expr | tests/test_serializers.py | test_it_should_not_validate_if_any_fields_missing | TestTokenObtainSerializer | 50 | null |
jazzband/djangorestframework-simplejwt | import builtins
import uuid
from datetime import datetime, timedelta
from importlib import reload
from json import JSONEncoder
from unittest import mock
from unittest.mock import patch
import jwt
import pytest
from django.test import TestCase
from jwt import PyJWS, algorithms
from jwt import __version__ as jwt_version... | ( "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJleHAiOjk0NjY4NDgwMH0.NHpdD2X8ub4SE_MZLBedWa57FCpntGaN_r6f8kNKdUs", "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJleHAiOjk0NjY4NDgwMH0.jvxQgXCSDToR8uKoRJcMT-LmMJJn2-NM76nfSR2FOgs", )) | self.assertIn | collection | tests/test_backends.py | test_encode_hmac | TestTokenBackend | 117 | null |
jazzband/djangorestframework-simplejwt | import builtins
import uuid
from datetime import datetime, timedelta
from importlib import reload
from json import JSONEncoder
from unittest import mock
from unittest.mock import patch
import jwt
import pytest
from django.test import TestCase
from jwt import PyJWS, algorithms
from jwt import __version__ as jwt_version... | TokenBackendError, f"You must have cryptography installed to use {algo}.") | self.assertRaisesRegex | complex_expr | tests/test_backends.py | test_init_fails_for_rs_algorithms_when_crypto_not_installed | TestTokenBackend | 82 | null |
jazzband/djangorestframework-simplejwt | from importlib import reload
from unittest.mock import patch
from django.contrib.auth.models import User
from django.core.management import call_command
from django.db.models import BigAutoField
from django.test import TestCase
from django.utils import timezone
from rest_framework_simplejwt.exceptions import TokenErr... | TokenError) | self.assertRaises | variable | tests/test_token_blacklist.py | test_token_will_not_validate_if_blacklisted | TestTokenBlacklist | 90 | null |
jazzband/djangorestframework-simplejwt | from datetime import timedelta
from django.contrib.auth import get_user_model
from django.urls import reverse
from rest_framework.status import HTTP_200_OK, HTTP_401_UNAUTHORIZED
from rest_framework_simplejwt.settings import api_settings
from rest_framework_simplejwt.tokens import AccessToken
from .utils import APIV... | "bar") | self.assertEqual | string_literal | tests/test_integration.py | test_user_can_get_sliding_token_and_use_it | TestTestView | 93 | null |
jazzband/djangorestframework-simplejwt | from importlib import reload
from unittest.mock import patch
from django.test import TestCase
from rest_framework_simplejwt.models import TokenUser
from rest_framework_simplejwt.settings import api_settings
AuthToken = api_settings.AUTH_TOKEN_CLASSES[0]
class TestTokenUser(TestCase):
def setUp(self):
se... | "42") | self.assertEqual | string_literal | tests/test_models.py | test_id | TestTokenUser | 43 | null |
jazzband/djangorestframework-simplejwt | from datetime import timedelta
from unittest import mock
from unittest.mock import patch
from django.contrib.auth import get_user_model
from django.utils import timezone
from rest_framework.test import APIRequestFactory
from rest_framework_simplejwt import serializers
from rest_framework_simplejwt.settings import api... | {}) | self.assertDictEqual | collection | tests/test_views.py | test_it_should_return_if_everything_ok | TestTokenBlacklistView | 429 | null |
jazzband/djangorestframework-simplejwt | from datetime import datetime, timedelta
from importlib import reload
from unittest.mock import patch
from django.contrib.auth import get_user_model
from django.test import TestCase
from freezegun import freeze_time
from jose import jwt
from rest_framework_simplejwt.exceptions import (
ExpiredTokenError,
Toke... | token) | self.assertIn | variable | tests/test_tokens.py | test_set_jti | TestToken | 251 | null |
jazzband/djangorestframework-simplejwt | import builtins
import uuid
from datetime import datetime, timedelta
from importlib import reload
from json import JSONEncoder
from unittest import mock
from unittest.mock import patch
import jwt
import pytest
from django.test import TestCase
from jwt import PyJWS, algorithms
from jwt import __version__ as jwt_version... | TokenBackendError, "Token is invalid") | self.assertRaisesRegex | complex_expr | tests/test_backends.py | test_decode_jwk_missing_key_raises_tokenbackenderror | TestTokenBackend | 353 | null |
jazzband/djangorestframework-simplejwt | from datetime import timedelta
from importlib import reload
from django.contrib.auth import get_user_model
from django.test import TestCase
from rest_framework.test import APIRequestFactory
from rest_framework_simplejwt import authentication
from rest_framework_simplejwt.exceptions import AuthenticationFailed, Invali... | messages[0]) | self.assertEqual | complex_expr | tests/test_authentication.py | test_get_validated_token_reject_unknown_token | TestJWTAuthentication | 112 | null |
jazzband/djangorestframework-simplejwt | from datetime import timedelta
from importlib import reload
from django.contrib.auth import get_user_model
from django.test import TestCase
from rest_framework.test import APIRequestFactory
from rest_framework_simplejwt import authentication
from rest_framework_simplejwt.exceptions import AuthenticationFailed, Invali... | self.fake_token) | self.assertEqual | complex_expr | tests/test_authentication.py | test_get_raw_token | TestJWTAuthentication | 70 | null |
jazzband/djangorestframework-simplejwt | from datetime import datetime, timedelta, timezone
from django.test import TestCase
from freezegun import freeze_time
from rest_framework_simplejwt.utils import (
aware_utcnow,
datetime_from_epoch,
datetime_to_epoch,
format_lazy,
make_utc,
)
class TestMakeUtc(TestCase):
def test_it_should_ret... | dt.tzinfo is None) | self.assertTrue | complex_expr | tests/test_utils.py | test_it_should_return_the_correct_values | TestMakeUtc | 26 | null |
jazzband/djangorestframework-simplejwt | from datetime import datetime, timedelta
from importlib import reload
from unittest.mock import patch
from django.contrib.auth import get_user_model
from django.test import TestCase
from freezegun import freeze_time
from jose import jwt
from rest_framework_simplejwt.exceptions import (
ExpiredTokenError,
Toke... | 1234) | self.assertEqual | numeric_literal | tests/test_tokens.py | test_setitem | TestToken | 224 | null |
jazzband/djangorestframework-simplejwt | from datetime import datetime, timedelta
from importlib import reload
from unittest.mock import patch
from django.contrib.auth import get_user_model
from django.test import TestCase
from freezegun import freeze_time
from jose import jwt
from rest_framework_simplejwt.exceptions import (
ExpiredTokenError,
Toke... | user_id) | self.assertEqual | variable | tests/test_tokens.py | test_for_user | TestToken | 389 | null |
jazzband/djangorestframework-simplejwt | from datetime import datetime, timedelta, timezone
from django.test import TestCase
from freezegun import freeze_time
from rest_framework_simplejwt.utils import (
aware_utcnow,
datetime_from_epoch,
datetime_to_epoch,
format_lazy,
make_utc,
)
class TestFormatLazy(TestCase):
def test_it_should_... | "arst zxcv") | self.assertEqual | string_literal | tests/test_utils.py | test_it_should_work | TestFormatLazy | 93 | null |
jazzband/djangorestframework-simplejwt | from datetime import timedelta
from django.contrib.auth import get_user_model
from django.urls import reverse
from rest_framework.status import HTTP_200_OK, HTTP_401_UNAUTHORIZED
from rest_framework_simplejwt.settings import api_settings
from rest_framework_simplejwt.tokens import AccessToken
from .utils import APIV... | HTTP_200_OK) | self.assertEqual | variable | tests/test_integration.py | test_user_can_get_sliding_token_and_use_it | TestTestView | 92 | null |
jazzband/djangorestframework-simplejwt | from datetime import timedelta
from importlib import reload
from django.contrib.auth import get_user_model
from django.test import TestCase
from rest_framework.test import APIRequestFactory
from rest_framework_simplejwt import authentication
from rest_framework_simplejwt.exceptions import AuthenticationFailed, Invali... | "bsaget") | self.assertEqual | string_literal | tests/test_authentication.py | test_custom_tokenuser | TestJWTStatelessUserAuthentication | 276 | null |
jazzband/djangorestframework-simplejwt | from datetime import datetime, timedelta, timezone
from django.test import TestCase
from freezegun import freeze_time
from rest_framework_simplejwt.utils import (
aware_utcnow,
datetime_from_epoch,
datetime_to_epoch,
format_lazy,
make_utc,
)
class TestDatetimeToEpoch(TestCase):
def test_it_sh... | 1) | self.assertEqual | numeric_literal | tests/test_utils.py | test_it_should_return_the_correct_values | TestDatetimeToEpoch | 51 | null |
jazzband/djangorestframework-simplejwt | from importlib import reload
from unittest.mock import patch
from django.contrib.auth.models import User
from django.core.management import call_command
from django.db.models import BigAutoField
from django.test import TestCase
from django.utils import timezone
from rest_framework_simplejwt.exceptions import TokenErr... | created) | self.assertTrue | variable | tests/test_token_blacklist.py | test_tokens_can_be_manually_blacklisted | TestTokenBlacklist | 111 | null |
jazzband/djangorestframework-simplejwt | from datetime import datetime, timedelta
from importlib import reload
from unittest.mock import patch
from django.contrib.auth import get_user_model
from django.test import TestCase
from freezegun import freeze_time
from jose import jwt
from rest_framework_simplejwt.exceptions import (
ExpiredTokenError,
Toke... | "access") | self.assertEqual | string_literal | tests/test_tokens.py | test_init | TestAccessToken | 430 | null |
jazzband/djangorestframework-simplejwt | from importlib import reload
from unittest.mock import patch
from django.contrib.auth.models import User
from django.core.management import call_command
from django.db.models import BigAutoField
from django.test import TestCase
from django.utils import timezone
from rest_framework_simplejwt.exceptions import TokenErr... | str(token)) | self.assertEqual | func_call | tests/test_token_blacklist.py | test_sliding_tokens_are_added_to_outstanding_list | TestTokenBlacklist | 52 | null |
jazzband/djangorestframework-simplejwt | from datetime import timedelta
from unittest import mock
from unittest.mock import patch
from django.contrib.auth import get_user_model
from django.utils import timezone
from rest_framework.test import APIRequestFactory
from rest_framework_simplejwt import serializers
from rest_framework_simplejwt.settings import api... | 400) | self.assertEqual | numeric_literal | tests/test_views.py | test_fields_missing | TestTokenObtainPairView | 38 | null |
jazzband/djangorestframework-simplejwt | from io import StringIO
from typing import Optional
import pytest
from django.core.management import call_command
from django.test import TestCase
class MigrationTestCase(TestCase):
def test_no_missing_migrations(self):
"""
Ensures all model changes are reflected in migrations.
If this tes... | f"Model changes detected that require migrations!\n" f"Please run `python manage.py makemigrations` to create the necessary migrations.\n\n" f"Detected Changes:\n{output.getvalue()}") | self.assertEqual | string_literal | tests/test_migrations.py | test_no_missing_migrations | MigrationTestCase | 36 | null |
jazzband/djangorestframework-simplejwt | from datetime import datetime, timedelta, timezone
from django.test import TestCase
from freezegun import freeze_time
from rest_framework_simplejwt.utils import (
aware_utcnow,
datetime_from_epoch,
datetime_to_epoch,
format_lazy,
make_utc,
)
class TestDatetimeToEpoch(TestCase):
def test_it_sh... | 0) | self.assertEqual | numeric_literal | tests/test_utils.py | test_it_should_return_the_correct_values | TestDatetimeToEpoch | 50 | null |
jazzband/djangorestframework-simplejwt | from datetime import timedelta
from importlib import reload
from django.contrib.auth import get_user_model
from django.test import TestCase
from rest_framework.test import APIRequestFactory
from rest_framework_simplejwt import authentication
from rest_framework_simplejwt.exceptions import AuthenticationFailed, Invali... | 42) | self.assertEqual | numeric_literal | tests/test_authentication.py | test_get_user | TestJWTStatelessUserAuthentication | 257 | null |
jazzband/djangorestframework-simplejwt | from datetime import timedelta
from django.contrib.auth import get_user_model
from django.urls import reverse
from rest_framework.status import HTTP_200_OK, HTTP_401_UNAUTHORIZED
from rest_framework_simplejwt.settings import api_settings
from rest_framework_simplejwt.tokens import AccessToken
from .utils import APIV... | HTTP_401_UNAUTHORIZED) | self.assertEqual | variable | tests/test_integration.py | test_no_authorization | TestTestView | 30 | null |
jazzband/djangorestframework-simplejwt | from datetime import timedelta
from importlib import reload
from unittest.mock import MagicMock, patch
from django.conf import settings
from django.contrib.auth import get_user_model
from django.test import TestCase, override_settings
from rest_framework import exceptions as drf_exceptions
from rest_framework_simplej... | {}) | self.assertDictEqual | collection | tests/test_serializers.py | test_it_should_return_nothing_if_everything_ok | TestTokenBlacklistSerializer | 698 | null |
jazzband/djangorestframework-simplejwt | from datetime import datetime, timedelta, timezone
from django.test import TestCase
from freezegun import freeze_time
from rest_framework_simplejwt.utils import (
aware_utcnow,
datetime_from_epoch,
datetime_to_epoch,
format_lazy,
make_utc,
)
class TestAwareUtcnow(TestCase):
def test_it_should... | aware_utcnow()) | self.assertEqual | func_call | tests/test_utils.py | test_it_should_return_the_correct_value | TestAwareUtcnow | 41 | null |
jazzband/djangorestframework-simplejwt | from datetime import datetime, timedelta
from importlib import reload
from unittest.mock import patch
from django.contrib.auth import get_user_model
from django.test import TestCase
from freezegun import freeze_time
from jose import jwt
from rest_framework_simplejwt.exceptions import (
ExpiredTokenError,
Toke... | 5) | self.assertEqual | numeric_literal | tests/test_tokens.py | test_init_token_given | TestToken | 120 | null |
jazzband/djangorestframework-simplejwt | from datetime import timedelta
from importlib import reload
from unittest.mock import MagicMock, patch
from django.conf import settings
from django.contrib.auth import get_user_model
from django.test import TestCase, override_settings
from rest_framework import exceptions as drf_exceptions
from rest_framework_simplej... | 2) | self.assertEqual | numeric_literal | tests/test_serializers.py | test_it_should_blacklist_refresh_token_if_tokens_should_be_rotated_and_blacklisted | TestTokenRefreshSerializer | 531 | null |
jazzband/djangorestframework-simplejwt | from datetime import datetime, timedelta
from importlib import reload
from unittest.mock import patch
from django.contrib.auth import get_user_model
from django.test import TestCase
from freezegun import freeze_time
from jose import jwt
from rest_framework_simplejwt.exceptions import (
ExpiredTokenError,
Toke... | "arst") | self.assertEqual | string_literal | tests/test_tokens.py | test_init_token_given | TestToken | 121 | null |
jazzband/djangorestframework-simplejwt | from datetime import timedelta
from importlib import reload
from django.contrib.auth import get_user_model
from django.test import TestCase
from rest_framework.test import APIRequestFactory
from rest_framework_simplejwt import authentication
from rest_framework_simplejwt.exceptions import AuthenticationFailed, Invali... | len(messages)) | self.assertEqual | func_call | tests/test_authentication.py | test_get_validated_token_reject_unknown_token | TestJWTAuthentication | 111 | null |
jazzband/djangorestframework-simplejwt | from datetime import datetime, timedelta
from importlib import reload
from unittest.mock import patch
from django.contrib.auth import get_user_model
from django.test import TestCase
from freezegun import freeze_time
from jose import jwt
from rest_framework_simplejwt.exceptions import (
ExpiredTokenError,
Toke... | payload) | self.assertEqual | variable | tests/test_tokens.py | test_init_bad_sig_token_given_no_verify | TestToken | 156 | null |
jazzband/djangorestframework-simplejwt | import builtins
import uuid
from datetime import datetime, timedelta
from importlib import reload
from json import JSONEncoder
from unittest import mock
from unittest.mock import patch
import jwt
import pytest
from django.test import TestCase
from jwt import PyJWS, algorithms
from jwt import __version__ as jwt_version... | TokenBackendError) | self.assertRaises | variable | tests/test_backends.py | test_init | TestTokenBackend | 74 | null |
jazzband/djangorestframework-simplejwt | from importlib import reload
from unittest.mock import patch
from django.contrib.auth.models import User
from django.core.management import call_command
from django.db.models import BigAutoField
from django.test import TestCase
from django.utils import timezone
from rest_framework_simplejwt.exceptions import TokenErr... | 6) | self.assertEqual | numeric_literal | tests/test_token_blacklist.py | test_it_should_delete_any_expired_tokens | TestTokenBlacklistFlushExpiredTokens | 226 | null |
jazzband/djangorestframework-simplejwt | from datetime import datetime, timedelta, timezone
from django.test import TestCase
from freezegun import freeze_time
from rest_framework_simplejwt.utils import (
aware_utcnow,
datetime_from_epoch,
datetime_to_epoch,
format_lazy,
make_utc,
)
class TestFormatLazy(TestCase):
def test_it_should_... | str) | self.assertNotIsInstance | variable | tests/test_utils.py | test_it_should_work | TestFormatLazy | 92 | null |
jazzband/djangorestframework-simplejwt | import builtins
import uuid
from datetime import datetime, timedelta
from importlib import reload
from json import JSONEncoder
from unittest import mock
from unittest.mock import patch
import jwt
import pytest
from django.test import TestCase
from jwt import PyJWS, algorithms
from jwt import __version__ as jwt_version... | str(unique)) | self.assertEqual | func_call | tests/test_backends.py | test_custom_JSONEncoder | TestTokenBackend | 409 | null |
jazzband/djangorestframework-simplejwt | from importlib import reload
from unittest.mock import patch
from django.test import TestCase
from rest_framework_simplejwt.models import TokenUser
from rest_framework_simplejwt.settings import api_settings
AuthToken = api_settings.AUTH_TOKEN_CLASSES[0]
class TestTokenUser(TestCase):
def setUp(self):
se... | "arstarst") | self.assertEqual | string_literal | tests/test_models.py | test_get_custom_claims_through_backup_getattr | TestTokenUser | 131 | null |
jazzband/djangorestframework-simplejwt | from datetime import timedelta
from importlib import reload
from django.contrib.auth import get_user_model
from django.test import TestCase
from rest_framework.test import APIRequestFactory
from rest_framework_simplejwt import authentication
from rest_framework_simplejwt.exceptions import AuthenticationFailed, Invali... | self.fake_header) | self.assertEqual | complex_expr | tests/test_authentication.py | test_get_header | TestJWTAuthentication | 36 | null |
jazzband/djangorestframework-simplejwt | from datetime import timedelta
from importlib import reload
from unittest.mock import MagicMock, patch
from django.conf import settings
from django.contrib.auth import get_user_model
from django.test import TestCase, override_settings
from rest_framework import exceptions as drf_exceptions
from rest_framework_simplej... | 1) | self.assertEqual | numeric_literal | tests/test_serializers.py | test_it_should_blacklist_refresh_token_if_tokens_should_be_rotated_and_blacklisted | TestTokenRefreshSerializer | 532 | null |
jazzband/djangorestframework-simplejwt | from importlib import reload
from unittest.mock import patch
from django.contrib.auth.models import User
from django.core.management import call_command
from django.db.models import BigAutoField
from django.test import TestCase
from django.utils import timezone
from rest_framework_simplejwt.exceptions import TokenErr... | self.user) | self.assertEqual | complex_expr | tests/test_token_blacklist.py | test_sliding_tokens_are_added_to_outstanding_list | TestTokenBlacklist | 50 | null |
jazzband/djangorestframework-simplejwt | from datetime import timedelta
from importlib import reload
from django.contrib.auth import get_user_model
from django.test import TestCase
from rest_framework.test import APIRequestFactory
from rest_framework_simplejwt import authentication
from rest_framework_simplejwt.exceptions import AuthenticationFailed, Invali... | user.id) | self.assertEqual | complex_expr | tests/test_authentication.py | test_get_user_with_str_user_id_claim | TestJWTAuthentication | 237 | null |
jazzband/djangorestframework-simplejwt | from importlib import reload
from unittest.mock import patch
from django.test import TestCase
from rest_framework_simplejwt.models import TokenUser
from rest_framework_simplejwt.settings import api_settings
AuthToken = api_settings.AUTH_TOKEN_CLASSES[0]
class TestTokenUser(TestCase):
def setUp(self):
se... | user3) | self.assertEqual | variable | tests/test_models.py | test_eq | TestTokenUser | 76 | null |
jazzband/djangorestframework-simplejwt | from datetime import timedelta
from unittest import mock
from unittest.mock import patch
from django.contrib.auth import get_user_model
from django.utils import timezone
from rest_framework.test import APIRequestFactory
from rest_framework_simplejwt import serializers
from rest_framework_simplejwt.settings import api... | 401) | self.assertEqual | numeric_literal | tests/test_views.py | test_credentials_wrong | TestTokenObtainPairView | 57 | null |
jazzband/djangorestframework-simplejwt | import builtins
import uuid
from datetime import datetime, timedelta
from importlib import reload
from json import JSONEncoder
from unittest import mock
from unittest.mock import patch
import jwt
import pytest
from django.test import TestCase
from jwt import PyJWS, algorithms
from jwt import __version__ as jwt_version... | original_payload) | self.assertEqual | variable | tests/test_backends.py | test_encode_aud_iss | TestTokenBackend | 148 | null |
jazzband/djangorestframework-simplejwt | from datetime import datetime, timedelta
from importlib import reload
from unittest.mock import patch
from django.contrib.auth import get_user_model
from django.test import TestCase
from freezegun import freeze_time
from jose import jwt
from rest_framework_simplejwt.exceptions import (
ExpiredTokenError,
Toke... | now) | self.assertEqual | variable | tests/test_tokens.py | test_init_no_token_given | TestToken | 88 | null |
jazzband/djangorestframework-simplejwt | from datetime import timedelta
from importlib import reload
from django.contrib.auth import get_user_model
from django.test import TestCase
from rest_framework.test import APIRequestFactory
from rest_framework_simplejwt import authentication
from rest_framework_simplejwt.exceptions import AuthenticationFailed, Invali... | u.id) | self.assertEqual | complex_expr | tests/test_authentication.py | test_get_user | TestJWTAuthentication | 162 | null |
jazzband/djangorestframework-simplejwt | import builtins
import uuid
from datetime import datetime, timedelta
from importlib import reload
from json import JSONEncoder
from unittest import mock
from unittest.mock import patch
import jwt
import pytest
from django.test import TestCase
from jwt import PyJWS, algorithms
from jwt import __version__ as jwt_version... | TokenBackendError, "Invalid algorithm specified") | self.assertRaisesRegex | complex_expr | tests/test_backends.py | test_decode_when_token_algorithm_does_not_match | TestTokenBackend | 378 | null |
jazzband/djangorestframework-simplejwt | from datetime import datetime, timedelta
from importlib import reload
from unittest.mock import patch
from django.contrib.auth import get_user_model
from django.test import TestCase
from freezegun import freeze_time
from jose import jwt
from rest_framework_simplejwt.exceptions import (
ExpiredTokenError,
Toke... | str) | self.assertIsInstance | variable | tests/test_tokens.py | test_token_user_id_claim_should_always_be_string | TestToken | 409 | null |
jazzband/djangorestframework-simplejwt | from importlib import reload
from unittest.mock import patch
from django.test import TestCase
from rest_framework_simplejwt.models import TokenUser
from rest_framework_simplejwt.settings import api_settings
AuthToken = api_settings.AUTH_TOKEN_CLASSES[0]
class TestTokenUser(TestCase):
def setUp(self):
se... | user.is_superuser) | self.assertFalse | complex_expr | tests/test_models.py | test_is_superuser | TestTokenUser | 63 | null |
jazzband/djangorestframework-simplejwt | from importlib import reload
from unittest.mock import patch
from django.test import TestCase
from rest_framework_simplejwt.models import TokenUser
from rest_framework_simplejwt.settings import api_settings
AuthToken = api_settings.AUTH_TOKEN_CLASSES[0]
class TestTokenUser(TestCase):
def setUp(self):
se... | user.is_staff) | self.assertFalse | complex_expr | tests/test_models.py | test_is_staff | TestTokenUser | 52 | null |
jazzband/djangorestframework-simplejwt | from datetime import timedelta
from unittest import mock
from unittest.mock import patch
from django.contrib.auth import get_user_model
from django.utils import timezone
from rest_framework.test import APIRequestFactory
from rest_framework_simplejwt import serializers
from rest_framework_simplejwt.settings import api... | 200) | self.assertEqual | numeric_literal | tests/test_views.py | test_success | TestTokenObtainPairView | 80 | null |
jazzband/djangorestframework-simplejwt | import builtins
import uuid
from datetime import datetime, timedelta
from importlib import reload
from json import JSONEncoder
from unittest import mock
from unittest.mock import patch
import jwt
import pytest
from django.test import TestCase
from jwt import PyJWS, algorithms
from jwt import __version__ as jwt_version... | payload) | self.assertEqual | variable | tests/test_backends.py | test_decode_with_invalid_sig_no_verify | TestTokenBackend | 251 | null |
jazzband/djangorestframework-simplejwt | from importlib import reload
from unittest.mock import patch
from django.test import TestCase
from rest_framework_simplejwt.models import TokenUser
from rest_framework_simplejwt.settings import api_settings
AuthToken = api_settings.AUTH_TOKEN_CLASSES[0]
class TestTokenUser(TestCase):
def setUp(self):
se... | user1 == user2) | self.assertFalse | complex_expr | tests/test_models.py | test_eq_not_implemented | TestTokenUser | 82 | null |
jazzband/djangorestframework-simplejwt | from importlib import reload
from importlib.metadata import PackageNotFoundError
from unittest.mock import Mock, patch
from django.test import SimpleTestCase
class TestInit(SimpleTestCase):
def test_package_is_not_installed(self):
with patch(
"importlib.metadata.version", Mock(side_effect=Pack... | None) | self.assertEqual | none_literal | tests/test_init.py | test_package_is_not_installed | TestInit | 15 | null |
jazzband/djangorestframework-simplejwt | from importlib import reload
from unittest.mock import patch
from django.test import TestCase
from rest_framework_simplejwt.models import TokenUser
from rest_framework_simplejwt.settings import api_settings
AuthToken = api_settings.AUTH_TOKEN_CLASSES[0]
class TestTokenUser(TestCase):
def setUp(self):
se... | "deep-thought") | self.assertEqual | string_literal | tests/test_models.py | test_username | TestTokenUser | 34 | null |
marcwebbie/passpie | import pytest
from passpie.credential import split_fullname, make_fullname
def test_split_fullname_returns_expected_login_and_name(mocker):
assert split_fullname("foo@example") == | ("foo", "example") | assert | collection | tests/test_credential.py | test_split_fullname_returns_expected_login_and_name | 13 | null | |
marcwebbie/passpie | from passpie.table import Table
def test_render_colorize_expected_columns(mocker):
colors = {'name': 'red', 'login': 'blue'}
table = Table(headers=['name', 'login'], colors=colors)
mock_tabulate = mocker.patch('passpie.table.tabulate')
mocker.patch.object(table, 'colorize', return_value='colorized')
... | 'example.com') | assert_* | string_literal | tests/test_table.py | test_render_colorize_expected_columns | 42 | null | |
marcwebbie/passpie | import pytest
from passpie.credential import split_fullname, make_fullname
def test_make_fullname_returns_expected_fullname(mocker):
assert make_fullname("foo", "bar") == "foo@bar"
assert make_fullname("_", "bar") == | "_@bar" | assert | string_literal | tests/test_credential.py | test_make_fullname_returns_expected_fullname | 22 | null | |
marcwebbie/passpie | from collections import namedtuple
import os
import shutil
import sys
import tempfile
import yaml
from passpie.importers import find_importer, BaseImporter, get_instances
from passpie.importers.default_importer import DefaultImporter
from passpie.importers.pysswords_importer import PysswordsImporter
def mock_open():... | dict_content.get('credentials') | assert | func_call | tests/test_importers/test_default_importer.py | test_default_importer_returns_loaded_credentials_from_yaml_file | 97 | null | |
marcwebbie/passpie | from passpie.table import Table
def test_table_colorile_calls_click_style_with_key_on_text(mocker):
mock_click = mocker.patch('passpie.table.click')
table = Table(headers=['name', 'login'], colors={'red': 'red'})
table.colorize(key='red', text='text')
assert mock_click.style.called
mock_click.styl... | 'text') | assert_* | string_literal | tests/test_table.py | test_table_colorile_calls_click_style_with_key_on_text | 9 | null | |
marcwebbie/passpie | from passpie.table import Table
def test_render_colorize_expected_columns(mocker):
colors = {'name': 'red', 'login': 'blue'}
table = Table(headers=['name', 'login'], colors=colors)
mock_tabulate = mocker.patch('passpie.table.tabulate')
mocker.patch.object(table, 'colorize', return_value='colorized')
... | ['header', 'header']) | assert_* | collection | tests/test_table.py | test_render_colorize_expected_columns | 44 | null | |
marcwebbie/passpie | import pytest
from passpie import clipboard
def test_copy_calls_copy_osx_when_on_darwin_system(mocker):
mocker.patch('passpie.clipboard.process.call')
mocker.patch('passpie.clipboard.platform.system', return_value='Darwin')
mock_copy_osx = mocker.patch('passpie.clipboard._copy_osx')
mock_copy_linux = ... | True | assert | bool_literal | tests/test_clipboard.py | test_copy_calls_copy_osx_when_on_darwin_system | 35 | null | |
marcwebbie/passpie | from collections import namedtuple
import os
import shutil
import sys
import tempfile
import yaml
from passpie.importers import find_importer, BaseImporter, get_instances
from passpie.importers.default_importer import DefaultImporter
from passpie.importers.pysswords_importer import PysswordsImporter
def mock_open():... | True | assert | bool_literal | tests/test_importers/test_pysswords_importer.py | test_pysswords_match_returns_true_when_expected_path | 72 | null | |
marcwebbie/passpie | import re
import pytest
from passpie.utils import genpass, mkdir_open, ensure_dependencies, touch
def mock_open():
try:
from mock import mock_open as mopen
except:
from unittest.mock import mock_open as mopen
return mopen()
def test_touch_open_file_on_path(mocker):
mock_builtin_open =... | 'w') | assert_* | string_literal | tests/test_utils.py | test_touch_open_file_on_path | 67 | null | |
marcwebbie/passpie | from collections import namedtuple
import os
import shutil
import sys
import tempfile
import yaml
from passpie.importers import find_importer, BaseImporter, get_instances
from passpie.importers.default_importer import DefaultImporter
from passpie.importers.pysswords_importer import PysswordsImporter
def mock_open():... | False | assert | bool_literal | tests/test_importers/test_default_importer.py | test_default_importer_returns_false_when_bad_file | 53 | null | |
marcwebbie/passpie | import pytest
from passpie.credential import split_fullname, make_fullname
def test_make_fullname_returns_expected_fullname(mocker):
assert make_fullname("foo", "bar") == | "foo@bar" | assert | string_literal | tests/test_credential.py | test_make_fullname_returns_expected_fullname | 21 | null | |
marcwebbie/passpie | import pytest
from passpie import clipboard
def test_clipboard_on_osx_ensure_commands(mocker):
mocker.patch('passpie.clipboard.process.call')
mock_ensure_commands = mocker.patch('passpie.clipboard.ensure_commands')
commands = clipboard.OSX_COMMANDS
clipboard._copy_osx('text')
mock_ensure_comman... | commands) | assert_* | variable | tests/test_clipboard.py | test_clipboard_on_osx_ensure_commands | 13 | null | |
marcwebbie/passpie | from collections import namedtuple
import os
import shutil
import sys
import tempfile
import yaml
from passpie.importers import find_importer, BaseImporter, get_instances
from passpie.importers.default_importer import DefaultImporter
from passpie.importers.pysswords_importer import PysswordsImporter
def mock_open():... | True | assert | bool_literal | tests/test_importers/test_default_importer.py | test_default_importer_match_passpie_exported_yaml | 44 | null | |
marcwebbie/passpie | import pytest
from passpie.process import Proc, call, DEVNULL, PIPE
def mock_popen(mocker):
return mocker.patch('passpie.process.Popen')
def test_call_uses_proc_communicate_with_input(mocker, mock_popen):
MockProc = mocker.patch('passpie.process.Proc')
MockProc().__enter__.return_value.communicate.return_... | True | assert | bool_literal | tests/test_process.py | test_call_uses_proc_communicate_with_input | 14 | null | |
marcwebbie/passpie | import os
from tinydb import where, Query
from tinydb.storages import MemoryStorage
from passpie.database import Database, PasspieStorage
from .helpers import MockerTestCase
class StorageTests(MockerTestCase):
def setUp(self):
self.mock_os = self.patch('passpie.database.os')
self.mock_shutil = s... | elements.keys()) | self.assertIn | func_call | tests/test_database.py | test_read_returns_all_found_credentials_in_default_dict | StorageTests | 30 | null |
marcwebbie/passpie | import os
from tinydb import where, Query
from tinydb.storages import MemoryStorage
from passpie.database import Database, PasspieStorage
from .helpers import MockerTestCase
def test_credentials_filter_credentials_by_login_and_name_when_full_fullname_passed(mocker):
config = {
'path': 'path',
'ex... | False | assert | bool_literal | tests/test_database.py | test_credentials_filter_credentials_by_login_and_name_when_full_fullname_passed | 231 | null | |
marcwebbie/passpie | import pytest
from passpie.history import ensure_git, Repository, clone
def mock_process(mocker):
return mocker.patch('passpie.history.process')
def test_git_commit_list_has_expected_commit_list(mocker, mock_process):
commit_list = [
'another commit',
'initial commit'
]
mock_process.ca... | len(commits) | assert | func_call | tests/test_history.py | test_git_commit_list_has_expected_commit_list | 164 | null | |
marcwebbie/passpie | from collections import namedtuple
import os
import shutil
import sys
import tempfile
import yaml
from passpie.importers import find_importer, BaseImporter, get_instances
from passpie.importers.default_importer import DefaultImporter
from passpie.importers.pysswords_importer import PysswordsImporter
def mock_open():... | [c['name'] for c in result] | assert | collection | tests/test_importers/test_pysswords_importer.py | test_pysswords_handle_returns_pysswords_credentials | 100 | null | |
marcwebbie/passpie | import os
from tinydb import where, Query
from tinydb.storages import MemoryStorage
from passpie.database import Database, PasspieStorage
from .helpers import MockerTestCase
def test_database_has_keys_returns_true_when_file_dot_keys_found_in_db_path(mocker):
config = {
'path': 'path',
'extension'... | mock_join('path', '.keys')) | assert_* | func_call | tests/test_database.py | test_database_has_keys_returns_true_when_file_dot_keys_found_in_db_path | 83 | null | |
marcwebbie/passpie | from collections import namedtuple
import os
import shutil
import sys
import tempfile
import yaml
from passpie.importers import find_importer, BaseImporter, get_instances
from passpie.importers.default_importer import DefaultImporter
from passpie.importers.pysswords_importer import PysswordsImporter
def mock_open():... | 'FakeKeepassImporterClass' | assert | string_literal | tests/test_importers/test_base_importer.py | test_find_importers_through_entry_points | 53 | null | |
marcwebbie/passpie | import csv
import click
from click.testing import CliRunner
import pytest
from passpie import cli
from passpie.database import Database
def test_validate_cols_returns_dict_with_col_position(mocker):
value = ',name,login,,password,,,comment'
cols = {
'name': 1,
'login': 2,
'password': ... | cols | assert | variable | tests/test_cli.py | test_validate_cols_returns_dict_with_col_position | 117 | null | |
marcwebbie/passpie | import pytest
from passpie.process import Proc, call, DEVNULL, PIPE
def mock_popen(mocker):
return mocker.patch('passpie.process.Popen')
def test_call_output_and_error_doesnt_decode_in_case_of_unicode(mocker, mock_popen):
MockProc = mocker.patch('passpie.process.Proc')
output = mocker.MagicMock()
erro... | output | assert | variable | tests/test_process.py | test_call_output_and_error_doesnt_decode_in_case_of_unicode | 66 | null | |
marcwebbie/passpie | import pytest
from passpie.history import ensure_git, Repository, clone
def mock_process(mocker):
return mocker.patch('passpie.history.process')
def test_git_sha_list_has_call_with_expected_command(mocker, mock_process):
output = 'a\nb'
mock_process.call.return_value = (output, '')
cmd = ['git', 'log'... | output.splitlines() | assert | func_call | tests/test_history.py | test_git_sha_list_has_call_with_expected_command | 128 | null | |
marcwebbie/passpie | import pytest
from passpie.process import Proc, call, DEVNULL, PIPE
def mock_popen(mocker):
return mocker.patch('passpie.process.Popen')
def test_call_output_and_error_doesnt_decode_in_case_of_unicode(mocker, mock_popen):
MockProc = mocker.patch('passpie.process.Proc')
output = mocker.MagicMock()
erro... | error | assert | variable | tests/test_process.py | test_call_output_and_error_doesnt_decode_in_case_of_unicode | 67 | null | |
marcwebbie/passpie | from collections import namedtuple
import os
import shutil
import sys
import tempfile
import yaml
from passpie.importers import find_importer, BaseImporter, get_instances
from passpie.importers.default_importer import DefaultImporter
from passpie.importers.pysswords_importer import PysswordsImporter
def mock_open():... | fake_importers | assert | variable | tests/test_importers/test_base_importer.py | test_get_all_yields_importers_from_entry_points | 74 | null | |
marcwebbie/passpie | import re
import pytest
from passpie.utils import genpass, mkdir_open, ensure_dependencies, touch
def mock_open():
try:
from mock import mock_open as mopen
except:
from unittest.mock import mock_open as mopen
return mopen()
def test_mkdir_open_handle_oserror_for_file_exist(mocker):
mo... | None | assert | none_literal | tests/test_utils.py | test_mkdir_open_handle_oserror_for_file_exist | 42 | null | |
marcwebbie/passpie | import pytest
from passpie.importers.keepass_importer import KeepassImporter
def test_keepass_importer_with_empty_reader_raises_value_error(mocker, mock_open):
mocker.patch('passpie.importers.keepass_importer.open', mock_open(), create=True)
mocker.patch('passpie.importers.keepass_importer.unicode_csv_reader'... | ValueError) | pytest.raises | variable | tests/test_importers/test_keepass_importer.py | test_keepass_importer_with_empty_reader_raises_value_error | 22 | null | |
marcwebbie/passpie | from collections import namedtuple
import os
import shutil
import sys
import tempfile
import yaml
from passpie.importers import find_importer, BaseImporter, get_instances
from passpie.importers.default_importer import DefaultImporter
from passpie.importers.pysswords_importer import PysswordsImporter
def mock_open():... | 'fake_module' | assert | string_literal | tests/test_importers/test_base_importer.py | test_find_importers_through_entry_points | 54 | null | |
marcwebbie/passpie | import os
from tinydb import where, Query
from tinydb.storages import MemoryStorage
from passpie.database import Database, PasspieStorage
from .helpers import MockerTestCase
def test_credentials_returns_sorted_list_credentials(mocker):
config = {
'path': 'path',
'extension': '.pass',
}
db... | mock_sorted() | assert | func_call | tests/test_database.py | test_credentials_returns_sorted_list_credentials | 215 | null | |
marcwebbie/passpie | import os
from tinydb import where, Query
from tinydb.storages import MemoryStorage
from passpie.database import Database, PasspieStorage
from .helpers import MockerTestCase
def test_credentials_filter_credentials_by_login_and_name_when_name_only_fullname_passed(mocker):
config = {
'path': 'path',
... | Credential.name == "example.com") | assert_* | complex_expr | tests/test_database.py | test_credentials_filter_credentials_by_login_and_name_when_name_only_fullname_passed | 270 | null | |
marcwebbie/passpie | import passpie.config
import yaml
def test_config_read_opens_path_and_load_yaml_content(mocker, mock_open):
config_file = mocker.patch('passpie.config.open', mock_open(), create=True)
mock_yaml = mocker.patch('passpie.config.yaml')
passpie.config.read('path')
assert mock_yaml.full_load.called
moc... | config_file().__enter__().read()) | assert_* | func_call | tests/test_config.py | test_config_read_opens_path_and_load_yaml_content | 11 | null | |
marcwebbie/passpie | import csv
import click
from click.testing import CliRunner
import pytest
from passpie import cli
from passpie.database import Database
def test_update_credentials_with_interactive_open_cred_in_editor(mocker, creds, mock_config, irunner):
credentials = creds.make(2)
fullname = credentials[0]['fullname']
... | True | assert | bool_literal | tests/test_cli.py | test_update_credentials_with_interactive_open_cred_in_editor | 225 | null | |
marcwebbie/passpie | from passpie import checkers
from datetime import datetime, timedelta
def test_modified_sets_credential_modifield_field_none(mocker):
credentials = [{'modified': datetime(year=2016, month=1, day=1)}]
expected_credentials = [{'modified': None}]
mock_datetime = mocker.patch('passpie.checkers.datetime')
m... | expected_credentials | assert | variable | tests/test_checkers.py | test_modified_sets_credential_modifield_field_none | 21 | null | |
marcwebbie/passpie | import re
import pytest
import passpie.crypt
from passpie.crypt import (
KEY_INPUT,
DEVNULL,
make_key_input,
export_keys,
export_secret_keys,
import_keys,
create_keys,
)
def mock_call(mocker):
return mocker.patch('passpie.crypt.process.call')
def mock_open():
try:
from mo... | True | assert | bool_literal | tests/test_crypt.py | test_crypt_export_secret_keys_calls_fallback_gpg_command_on_export_keys_when_error | 64 | null |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.