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 |
|---|---|---|---|---|---|---|---|---|---|
PedroBern/django-graphql-auth | from smtplib import SMTPException
from unittest import mock
from django.contrib.auth import get_user_model
from .testCases import RelayTestCase, DefaultTestCase
from graphql_auth.constants import Messages
class SendPasswordResetEmailTestCaseMixin:
def setUp(self):
self.user1 = self.register_user(
... | False) | self.assertEqual | bool_literal | tests/test_send_password_reset_email.py | test_invalid_form | SendPasswordResetEmailTestCaseMixin | 35 | null |
PedroBern/django-graphql-auth | from django.contrib.auth import get_user_model
from .testCases import RelayTestCase, DefaultTestCase
from graphql_auth.constants import Messages
from graphql_auth.utils import get_token, get_token_payload
class PasswordResetTestCaseMixin:
def setUp(self):
self.user1 = self.register_user(
email... | True) | self.assertEqual | bool_literal | tests/test_password_reset.py | test_reset_password | PasswordResetTestCaseMixin | 19 | null |
PedroBern/django-graphql-auth | from django.contrib.auth import get_user_model
from django.utils import timezone
from .testCases import RelayTestCase, DefaultTestCase
from graphql_auth.constants import Messages
class RefreshTokenTestCaseMixin:
def setUp(self):
self.user = self.register_user(
email="foo@email.com", username=... | executed["refreshToken"]) | self.assertTrue | complex_expr | tests/test_refresh_token.py | test_refresh_token | RefreshTokenTestCaseMixin | 18 | null |
PedroBern/django-graphql-auth | from smtplib import SMTPException
from unittest import mock
from django.contrib.auth import get_user_model
from .testCases import RelayTestCase, DefaultTestCase
from graphql_auth.constants import Messages
class ResendActivationEmailTestCaseMixin:
def setUp(self):
self.user1 = self.register_user(
... | False) | self.assertEqual | bool_literal | tests/test_resend_activation_email.py | test_resend_email_valid_email_verified | ResendActivationEmailTestCaseMixin | 37 | null |
PedroBern/django-graphql-auth | from django.contrib.auth import get_user_model
from graphql_jwt.refresh_token.models import RefreshToken
from .testCases import RelayTestCase, DefaultTestCase
from graphql_auth.utils import revoke_user_refresh_token
from graphql_auth.constants import Messages
from graphql_auth.utils import get_token, get_token_paylo... | False) | self.assertEqual | bool_literal | tests/test_password_change.py | test_mismatch_passwords | PasswordChangeTestCaseMixin | 38 | null |
PedroBern/django-graphql-auth | from pytest import mark
from django.contrib.auth import get_user_model
from .testCases import RelayTestCase, DefaultTestCase
from .decorators import skipif_django_21
from graphql_auth.constants import Messages
class UpdateAccountTestCaseMixin:
def setUp(self):
self.user1 = self.register_user(
... | executed["errors"]["nonFieldErrors"]) | self.assertTrue | complex_expr | tests/test_update_account.py | test_update_account_non_field_errors | UpdateAccountTestCaseMixin | 83 | null |
PedroBern/django-graphql-auth | from django.contrib.auth import get_user_model
from pytest import mark
from .decorators import skipif_django_21
from .testCases import RelayTestCase, DefaultTestCase
from graphql_auth.constants import Messages
class LoginTestCaseMixin:
def setUp(self):
self.archived_user = self.register_user(
e... | executed["token"]) | self.assertTrue | complex_expr | tests/test_login.py | test_archived_user_becomes_active_on_login | LoginTestCaseMixin | 31 | null |
PedroBern/django-graphql-auth | from django.test import TestCase
from .testCases import DefaultTestCase
class QueryTestCase(DefaultTestCase):
def setUp(self):
self.user1 = self.register_user(
email="foo@email.com", username="foo", verified=False
)
self.user2 = self.register_user(
email="bar@email.... | executed) | self.assertIsNone | variable | tests/test_query.py | test_me_anonymous | QueryTestCase | 86 | null |
PedroBern/django-graphql-auth | from django.contrib.auth import get_user_model
from graphql_auth.constants import Messages
from .testCases import RelayTestCase, DefaultTestCase
class RemoveSecondaryEmailCaseMixin:
def setUp(self):
self.user = self.register_user(
email="bar@email.com",
username="bar",
... | executed["errors"]) | self.assertFalse | complex_expr | tests/test_remove_secondary_email.py | test_remove_email | RemoveSecondaryEmailCaseMixin | 21 | null |
PedroBern/django-graphql-auth | import django
from pytest import mark
from django.contrib.auth import get_user_model
from django.core.exceptions import ObjectDoesNotExist
from django.conf import settings
from .testCases import RelayTestCase, DefaultTestCase
from .decorators import skipif_django_21
from graphql_auth.constants import Messages
from g... | True) | self.assertEqual | bool_literal | tests/test_delete_account.py | test_revoke_refresh_tokens_on_delete_account | DeleteAccountTestCaseMixin | 48 | null |
PedroBern/django-graphql-auth | from smtplib import SMTPException
from unittest import mock
from pytest import mark
from django.contrib.auth import get_user_model
from .testCases import RelayTestCase, DefaultTestCase
from .decorators import skipif_django_21
from graphql_auth.constants import Messages
from graphql_auth.signals import user_register... | executed["token"]) | self.assertFalse | complex_expr | tests/test_register.py | test_register_duplicate_unique_email | RegisterTestCaseMixin | 74 | null |
PedroBern/django-graphql-auth | from smtplib import SMTPException
from unittest import mock
from django.contrib.auth import get_user_model
from .testCases import RelayTestCase, DefaultTestCase
from graphql_auth.constants import Messages
class ResendActivationEmailTestCaseMixin:
def setUp(self):
self.user1 = self.register_user(
... | None) | self.assertEqual | none_literal | tests/test_resend_activation_email.py | test_resend_email_invalid_email | ResendActivationEmailTestCaseMixin | 26 | null |
PedroBern/django-graphql-auth | import django
from pytest import mark
from django.contrib.auth import get_user_model
from django.core.exceptions import ObjectDoesNotExist
from django.conf import settings
from .testCases import RelayTestCase, DefaultTestCase
from .decorators import skipif_django_21
from graphql_auth.constants import Messages
from g... | token.revoked) | self.assertFalse | complex_expr | tests/test_delete_account.py | test_revoke_refresh_tokens_on_delete_account | DeleteAccountTestCaseMixin | 44 | null |
PedroBern/django-graphql-auth | from django.contrib.auth import get_user_model
from django.utils import timezone
from .testCases import RelayTestCase, DefaultTestCase
from graphql_auth.constants import Messages
class RefreshTokenTestCaseMixin:
def setUp(self):
self.user = self.register_user(
email="foo@email.com", username=... | executed["success"]) | self.assertTrue | complex_expr | tests/test_refresh_token.py | test_refresh_token | RefreshTokenTestCaseMixin | 22 | null |
PedroBern/django-graphql-auth | from unittest import skip
from django.contrib.auth import get_user_model
from django.utils import timezone
from .testCases import RelayTestCase, DefaultTestCase
from graphql_auth.constants import Messages
class RevokeTokenTestCaseMixin:
def setUp(self):
self.user1 = self.register_user(email="foo@email.co... | executed["refreshToken"]) | self.assertTrue | complex_expr | tests/test_revoke_token.py | test_revoke_token | RevokeTokenTestCaseMixin | 22 | null |
PedroBern/django-graphql-auth | from django.contrib.auth import get_user_model
from .testCases import RelayTestCase, DefaultTestCase
from graphql_auth.constants import Messages
from graphql_auth.models import UserStatus
class ArchiveAccountTestCaseMixin:
def setUp(self):
self.user1 = self.register_user(email="foo@email.com", username="... | False) | self.assertEqual | bool_literal | tests/test_archive_account.py | test_not_authenticated | ArchiveAccountTestCaseMixin | 22 | null |
PedroBern/django-graphql-auth | from django.test import TestCase
from .testCases import DefaultTestCase
class QueryTestCase(DefaultTestCase):
def setUp(self):
self.user1 = self.register_user(
email="foo@email.com", username="foo", verified=False
)
self.user2 = self.register_user(
email="bar@email.... | executed["username"]) | self.assertTrue | complex_expr | tests/test_query.py | test_me_authenticated | QueryTestCase | 75 | null |
PedroBern/django-graphql-auth | from smtplib import SMTPException
from unittest import mock
from pytest import mark
from django.contrib.auth import get_user_model
from .testCases import RelayTestCase, DefaultTestCase
from .decorators import skipif_django_21
from graphql_auth.constants import Messages
from graphql_auth.signals import user_register... | False) | self.assertEqual | bool_literal | tests/test_register.py | test_register_invalid_password_validation | RegisterTestCaseMixin | 24 | null |
PedroBern/django-graphql-auth | from django.contrib.auth import get_user_model
from .testCases import RelayTestCase, DefaultTestCase
from graphql_auth.constants import Messages
from graphql_auth.utils import get_token, get_token_payload
class PasswordResetTestCaseMixin:
def setUp(self):
self.user1 = self.register_user(
email... | self.user1_old_pass == self.user1.password) | self.assertFalse | complex_expr | tests/test_password_reset.py | test_reset_password | PasswordResetTestCaseMixin | 22 | null |
PedroBern/django-graphql-auth | from django.contrib.auth import get_user_model
from .testCases import RelayTestCase, DefaultTestCase
from graphql_auth.constants import Messages
from graphql_auth.models import UserStatus
class ArchiveAccountTestCaseMixin:
def setUp(self):
self.user1 = self.register_user(email="foo@email.com", username="... | Messages.NOT_VERIFIED) | self.assertEqual | complex_expr | tests/test_archive_account.py | test_not_verified_user | ArchiveAccountTestCaseMixin | 82 | null |
PedroBern/django-graphql-auth | from django.contrib.auth import get_user_model
from .testCases import RelayTestCase, DefaultTestCase
from graphql_auth.constants import Messages
from graphql_auth.utils import get_token, get_token_payload
from graphql_auth.models import UserStatus
from graphql_auth.signals import user_verified
class VerifyAccountCase... | signal_received) | self.assertTrue | variable | tests/test_verify_account.py | test_verify_user | VerifyAccountCaseMixin | 32 | null |
PedroBern/django-graphql-auth | from django.contrib.auth import get_user_model
from .testCases import RelayTestCase, DefaultTestCase
from graphql_auth.constants import Messages
from graphql_auth.utils import get_token, get_token_payload
class PasswordResetTestCaseMixin:
def setUp(self):
self.user1 = self.register_user(
email... | token.revoked) | self.assertFalse | complex_expr | tests/test_password_reset.py | test_revoke_refresh_tokens_on_password_reset | PasswordResetTestCaseMixin | 46 | null |
PedroBern/django-graphql-auth | from smtplib import SMTPException
from unittest import mock
from django.contrib.auth import get_user_model
from .testCases import RelayTestCase, DefaultTestCase
from graphql_auth.constants import Messages
class ResendActivationEmailTestCaseMixin:
def setUp(self):
self.user1 = self.register_user(
... | Messages.ALREADY_VERIFIED) | self.assertEqual | complex_expr | tests/test_resend_activation_email.py | test_resend_email_valid_email_verified | ResendActivationEmailTestCaseMixin | 38 | null |
PedroBern/django-graphql-auth | from smtplib import SMTPException
from unittest import mock
from pytest import mark
from django.contrib.auth import get_user_model
from .testCases import RelayTestCase, DefaultTestCase
from .decorators import skipif_django_21
from graphql_auth.constants import Messages
from graphql_auth.signals import user_register... | executed["errors"]) | self.assertTrue | complex_expr | tests/test_register.py | test_register_invalid_password_validation | RegisterTestCaseMixin | 25 | null |
PedroBern/django-graphql-auth | from django.contrib.auth import get_user_model
from .testCases import RelayTestCase, DefaultTestCase
from graphql_auth.constants import Messages
from graphql_auth.utils import get_token
from graphql_auth.models import UserStatus
class VerifySecondaryEmailCaseMixin:
def setUp(self):
self.user = self.regist... | True) | self.assertEqual | bool_literal | tests/test_verify_secondary_email.py | test_verify_secondary_email | VerifySecondaryEmailCaseMixin | 25 | null |
PedroBern/django-graphql-auth | import django
from pytest import mark
from django.contrib.auth import get_user_model
from django.core.exceptions import ObjectDoesNotExist
from django.conf import settings
from .testCases import RelayTestCase, DefaultTestCase
from .decorators import skipif_django_21
from graphql_auth.constants import Messages
from g... | False) | self.assertEqual | bool_literal | tests/test_delete_account.py | test_not_authenticated | DeleteAccountTestCaseMixin | 28 | null |
PedroBern/django-graphql-auth | import django
from pytest import mark
from django.contrib.auth import get_user_model
from django.core.exceptions import ObjectDoesNotExist
from django.conf import settings
from .testCases import RelayTestCase, DefaultTestCase
from .decorators import skipif_django_21
from graphql_auth.constants import Messages
from g... | None) | self.assertEqual | none_literal | tests/test_delete_account.py | test_revoke_refresh_tokens_on_delete_account | DeleteAccountTestCaseMixin | 51 | null |
PedroBern/django-graphql-auth | from django.contrib.auth import get_user_model
from pytest import mark
from .decorators import skipif_django_21
from .testCases import RelayTestCase, DefaultTestCase
from graphql_auth.constants import Messages
class LoginTestCaseMixin:
def setUp(self):
self.archived_user = self.register_user(
e... | executed["errors"]) | self.assertFalse | complex_expr | tests/test_login.py | test_archived_user_becomes_active_on_login | LoginTestCaseMixin | 30 | null |
PedroBern/django-graphql-auth | from django.contrib.auth import get_user_model
from .testCases import RelayTestCase, DefaultTestCase
from graphql_auth.constants import Messages
from graphql_auth.models import UserStatus
class ArchiveAccountTestCaseMixin:
def setUp(self):
self.user1 = self.register_user(email="foo@email.com", username="... | True) | self.assertEqual | bool_literal | tests/test_archive_account.py | test_valid_password | ArchiveAccountTestCaseMixin | 43 | null |
PedroBern/django-graphql-auth | from django.contrib.auth import get_user_model
from graphql_auth.constants import Messages
from .testCases import RelayTestCase, DefaultTestCase
class SwapEmailsCaseMixin:
def setUp(self):
self.user = self.register_user(
email="bar@email.com",
username="bar",
verified=... | True) | self.assertEqual | bool_literal | tests/test_swap_emails.py | test_swap_emails | SwapEmailsCaseMixin | 23 | null |
PedroBern/django-graphql-auth | from smtplib import SMTPException
from unittest import mock
from pytest import mark
from django.contrib.auth import get_user_model
from .testCases import RelayTestCase, DefaultTestCase
from .decorators import skipif_django_21
from graphql_auth.constants import Messages
from graphql_auth.signals import user_register... | Messages.EMAIL_FAIL) | self.assertEqual | complex_expr | tests/test_register.py | test_register_email_send_fail | RegisterTestCaseMixin | 94 | null |
PedroBern/django-graphql-auth | def pseudo_async_email_support(func, args):
assert True == | True | assert | bool_literal | testproject/pseudo_async_email_support.py | pseudo_async_email_support | 2 | null | |
PedroBern/django-graphql-auth | from django.contrib.auth import get_user_model
from django.utils import timezone
from .testCases import RelayTestCase, DefaultTestCase
from graphql_auth.constants import Messages
class VerifyTokenTestCaseMixin:
def setUp(self):
self.user = self.register_user(
email="foo@email.com", username="... | executed["success"]) | self.assertTrue | complex_expr | tests/test_verify_token.py | test_verify_token | VerifyTokenTestCaseMixin | 22 | null |
PedroBern/django-graphql-auth | from django.contrib.auth import get_user_model
from django.utils import timezone
from .testCases import RelayTestCase, DefaultTestCase
from graphql_auth.constants import Messages
class VerifyTokenTestCaseMixin:
def setUp(self):
self.user = self.register_user(
email="foo@email.com", username="... | executed["payload"]) | self.assertTrue | complex_expr | tests/test_verify_token.py | test_verify_token | VerifyTokenTestCaseMixin | 23 | null |
PedroBern/django-graphql-auth | from django.contrib.auth import get_user_model
from graphql_jwt.refresh_token.models import RefreshToken
from .testCases import RelayTestCase, DefaultTestCase
from graphql_auth.utils import revoke_user_refresh_token
from graphql_auth.constants import Messages
from graphql_auth.utils import get_token, get_token_paylo... | executed["refreshToken"]) | self.assertTrue | complex_expr | tests/test_password_change.py | test_password_change | PasswordChangeTestCaseMixin | 28 | null |
PedroBern/django-graphql-auth | from django.contrib.auth import get_user_model
from graphql_auth.constants import Messages
from .testCases import RelayTestCase, DefaultTestCase
class SwapEmailsCaseMixin:
def setUp(self):
self.user = self.register_user(
email="bar@email.com",
username="bar",
verified=... | "secondary@email.com") | self.assertEqual | string_literal | tests/test_swap_emails.py | test_swap_emails | SwapEmailsCaseMixin | 26 | null |
PedroBern/django-graphql-auth | from smtplib import SMTPException
from unittest import mock
from django.contrib.auth import get_user_model
from .testCases import RelayTestCase, DefaultTestCase
from graphql_auth.constants import Messages
class SendPasswordResetEmailTestCaseMixin:
def setUp(self):
self.user1 = self.register_user(
... | Messages.EMAIL_FAIL) | self.assertEqual | complex_expr | tests/test_send_password_reset_email.py | test_send_email_fail_to_send_email | SendPasswordResetEmailTestCaseMixin | 59 | null |
PedroBern/django-graphql-auth | from django.contrib.auth import get_user_model
from graphql_jwt.refresh_token.models import RefreshToken
from .testCases import RelayTestCase, DefaultTestCase
from graphql_auth.utils import revoke_user_refresh_token
from graphql_auth.constants import Messages
from graphql_auth.utils import get_token, get_token_paylo... | True) | self.assertEqual | bool_literal | tests/test_password_change.py | test_password_change | PasswordChangeTestCaseMixin | 25 | null |
PedroBern/django-graphql-auth | from django.contrib.auth import get_user_model
from django.utils import timezone
from .testCases import RelayTestCase, DefaultTestCase
from graphql_auth.constants import Messages
class RefreshTokenTestCaseMixin:
def setUp(self):
self.user = self.register_user(
email="foo@email.com", username=... | executed["errors"]) | self.assertFalse | complex_expr | tests/test_refresh_token.py | test_refresh_token | RefreshTokenTestCaseMixin | 25 | null |
PedroBern/django-graphql-auth | from django.contrib.auth import get_user_model
from .testCases import RelayTestCase, DefaultTestCase
from graphql_auth.constants import Messages
from graphql_auth.utils import get_token, get_token_payload
class PasswordSetTestCaseMixin:
def setUp(self):
self.user1 = self.register_user(
email="... | self.user1_old_pass != self.user1.password) | self.assertFalse | complex_expr | tests/test_password_set.py | test_already_set_password | PasswordSetTestCaseMixin | 32 | null |
PedroBern/django-graphql-auth | from django.contrib.auth import get_user_model
from django.utils import timezone
from .testCases import RelayTestCase, DefaultTestCase
from graphql_auth.constants import Messages
class VerifyTokenTestCaseMixin:
def setUp(self):
self.user = self.register_user(
email="foo@email.com", username="... | executed["errors"]) | self.assertFalse | complex_expr | tests/test_verify_token.py | test_verify_token | VerifyTokenTestCaseMixin | 24 | null |
PedroBern/django-graphql-auth | from django.contrib.auth import get_user_model
from .testCases import RelayTestCase, DefaultTestCase
from graphql_auth.constants import Messages
from graphql_auth.utils import get_token, get_token_payload
from graphql_auth.models import UserStatus
from graphql_auth.signals import user_verified
class VerifyAccountCase... | self.user1.id) | self.assertEqual | complex_expr | tests/test_verify_account.py | receive_signal | VerifyAccountCaseMixin | 23 | null |
PedroBern/django-graphql-auth | from django.contrib.auth import get_user_model
from django.utils import timezone
from .testCases import RelayTestCase, DefaultTestCase
from graphql_auth.constants import Messages
class RefreshTokenTestCaseMixin:
def setUp(self):
self.user = self.register_user(
email="foo@email.com", username=... | executed["payload"]) | self.assertTrue | complex_expr | tests/test_refresh_token.py | test_refresh_token | RefreshTokenTestCaseMixin | 24 | null |
PedroBern/django-graphql-auth | from graphql_auth import settings
from django.test import TestCase
class AppSettingsTestCase(TestCase):
def test_reload_settings(self):
self.assertTrue( | settings.graphql_auth_settings.ALLOW_LOGIN_NOT_VERIFIED) | self.assertTrue | complex_expr | tests/test_app_settings.py | test_reload_settings | AppSettingsTestCase | 8 | null |
PedroBern/django-graphql-auth | from smtplib import SMTPException
from unittest import mock
from pytest import mark
from django.contrib.auth import get_user_model
from .testCases import RelayTestCase, DefaultTestCase
from .decorators import skipif_django_21
from graphql_auth.constants import Messages
from graphql_auth.signals import user_register... | user.id is not None) | self.assertTrue | complex_expr | tests/test_register.py | receive_signal | RegisterTestCaseMixin | 34 | null |
PedroBern/django-graphql-auth | from django.contrib.auth import get_user_model
from graphql_auth.constants import Messages
from .testCases import RelayTestCase, DefaultTestCase
class RemoveSecondaryEmailCaseMixin:
def setUp(self):
self.user = self.register_user(
email="bar@email.com",
username="bar",
... | None) | self.assertEqual | none_literal | tests/test_remove_secondary_email.py | test_remove_email | RemoveSecondaryEmailCaseMixin | 23 | null |
PedroBern/django-graphql-auth | from django.contrib.auth import get_user_model
from .testCases import RelayTestCase, DefaultTestCase
from graphql_auth.constants import Messages
from graphql_auth.utils import get_token
from graphql_auth.models import UserStatus
class VerifySecondaryEmailCaseMixin:
def setUp(self):
self.user = self.regist... | executed["errors"]) | self.assertFalse | complex_expr | tests/test_verify_secondary_email.py | test_verify_secondary_email | VerifySecondaryEmailCaseMixin | 26 | null |
PedroBern/django-graphql-auth | from django.contrib.auth import get_user_model
from pytest import mark
from .decorators import skipif_django_21
from .testCases import RelayTestCase, DefaultTestCase
from graphql_auth.constants import Messages
class LoginTestCaseMixin:
def setUp(self):
self.archived_user = self.register_user(
e... | False) | self.assertEqual | bool_literal | tests/test_login.py | test_archived_user_becomes_active_on_login | LoginTestCaseMixin | 28 | null |
PedroBern/django-graphql-auth | from smtplib import SMTPException
from unittest import mock
from django.contrib.auth import get_user_model
from .testCases import RelayTestCase, DefaultTestCase
from graphql_auth.constants import Messages
class ResendActivationEmailTestCaseMixin:
def setUp(self):
self.user1 = self.register_user(
... | Messages.EMAIL_FAIL) | self.assertEqual | complex_expr | tests/test_resend_activation_email.py | test_resend_email_fail_to_send_email | ResendActivationEmailTestCaseMixin | 58 | null |
PedroBern/django-graphql-auth | from django.contrib.auth import get_user_model
from .testCases import RelayTestCase, DefaultTestCase
from graphql_auth.constants import Messages
from graphql_auth.utils import get_token, get_token_payload
class PasswordResetTestCaseMixin:
def setUp(self):
self.user1 = self.register_user(
email... | self.user1_old_pass != self.user1.password) | self.assertFalse | complex_expr | tests/test_password_reset.py | test_reset_password_invalid_form | PasswordResetTestCaseMixin | 31 | null |
PedroBern/django-graphql-auth | from smtplib import SMTPException
from unittest import mock
from django.contrib.auth import get_user_model
from .testCases import RelayTestCase, DefaultTestCase
from graphql_auth.constants import Messages
class ResendActivationEmailTestCaseMixin:
def setUp(self):
self.user1 = self.register_user(
... | executed["errors"]["email"]) | self.assertTrue | complex_expr | tests/test_resend_activation_email.py | test_invalid_form | ResendActivationEmailTestCaseMixin | 44 | null |
PedroBern/django-graphql-auth | from django.contrib.auth import get_user_model
from graphql_auth.constants import Messages
from .testCases import RelayTestCase, DefaultTestCase
class RemoveSecondaryEmailCaseMixin:
def setUp(self):
self.user = self.register_user(
email="bar@email.com",
username="bar",
... | True) | self.assertEqual | bool_literal | tests/test_remove_secondary_email.py | test_remove_email | RemoveSecondaryEmailCaseMixin | 20 | null |
PedroBern/django-graphql-auth | from django.contrib.auth import get_user_model
from .testCases import RelayTestCase, DefaultTestCase
from graphql_auth.constants import Messages
from graphql_auth.utils import get_token, get_token_payload
class PasswordResetTestCaseMixin:
def setUp(self):
self.user1 = self.register_user(
email... | None) | self.assertEqual | none_literal | tests/test_password_reset.py | test_reset_password | PasswordResetTestCaseMixin | 20 | null |
PedroBern/django-graphql-auth | from unittest import skip
from django.contrib.auth import get_user_model
from django.utils import timezone
from .testCases import RelayTestCase, DefaultTestCase
from graphql_auth.constants import Messages
class RevokeTokenTestCaseMixin:
def setUp(self):
self.user1 = self.register_user(email="foo@email.co... | executed["success"]) | self.assertTrue | complex_expr | tests/test_revoke_token.py | test_revoke_token | RevokeTokenTestCaseMixin | 26 | null |
PedroBern/django-graphql-auth | from django.contrib.auth import get_user_model
from pytest import mark
from .decorators import skipif_django_21
from .testCases import RelayTestCase, DefaultTestCase
from graphql_auth.constants import Messages
class LoginTestCaseMixin:
def setUp(self):
self.archived_user = self.register_user(
e... | executed["success"]) | self.assertTrue | complex_expr | tests/test_login.py | test_archived_user_becomes_active_on_login | LoginTestCaseMixin | 29 | null |
PedroBern/django-graphql-auth | from django.contrib.auth import get_user_model
from graphql_auth.constants import Messages
from .testCases import RelayTestCase, DefaultTestCase
class SwapEmailsCaseMixin:
def setUp(self):
self.user = self.register_user(
email="bar@email.com",
username="bar",
verified=... | "bar@email.com") | self.assertEqual | string_literal | tests/test_swap_emails.py | test_swap_emails | SwapEmailsCaseMixin | 27 | null |
PedroBern/django-graphql-auth | from django.contrib.auth import get_user_model
from .testCases import RelayTestCase, DefaultTestCase
from graphql_auth.constants import Messages
from graphql_auth.models import UserStatus
class ArchiveAccountTestCaseMixin:
def setUp(self):
self.user1 = self.register_user(email="foo@email.com", username="... | token.revoked) | self.assertFalse | complex_expr | tests/test_archive_account.py | test_revoke_refresh_tokens_on_archive_account | ArchiveAccountTestCaseMixin | 57 | null |
PedroBern/django-graphql-auth | from unittest import skip
from django.contrib.auth import get_user_model
from django.utils import timezone
from .testCases import RelayTestCase, DefaultTestCase
from graphql_auth.constants import Messages
class RevokeTokenTestCaseMixin:
def setUp(self):
self.user1 = self.register_user(email="foo@email.co... | executed["errors"]) | self.assertFalse | complex_expr | tests/test_revoke_token.py | test_revoke_token | RevokeTokenTestCaseMixin | 28 | null |
PedroBern/django-graphql-auth | from django.contrib.auth import get_user_model
from .testCases import RelayTestCase, DefaultTestCase
from graphql_auth.constants import Messages
from graphql_auth.utils import get_token, get_token_payload
class PasswordResetTestCaseMixin:
def setUp(self):
self.user1 = self.register_user(
email... | executed["errors"]["nonFieldErrors"]) | self.assertTrue | complex_expr | tests/test_password_reset.py | test_reset_password_invalid_token | PasswordResetTestCaseMixin | 37 | null |
PedroBern/django-graphql-auth | from django.contrib.auth import get_user_model
from graphql_auth.constants import Messages
from .testCases import RelayTestCase, DefaultTestCase
class SwapEmailsCaseMixin:
def setUp(self):
self.user = self.register_user(
email="bar@email.com",
username="bar",
verified=... | Messages.SECONDARY_EMAIL_REQUIRED) | self.assertEqual | complex_expr | tests/test_swap_emails.py | test_swap_emails_without_secondary_email | SwapEmailsCaseMixin | 32 | null |
PedroBern/django-graphql-auth | from django.contrib.auth import get_user_model
from .testCases import RelayTestCase, DefaultTestCase
from graphql_auth.constants import Messages
from graphql_auth.models import UserStatus
class ArchiveAccountTestCaseMixin:
def setUp(self):
self.user1 = self.register_user(email="foo@email.com", username="... | None) | self.assertEqual | none_literal | tests/test_archive_account.py | test_valid_password | ArchiveAccountTestCaseMixin | 44 | null |
PedroBern/django-graphql-auth | from django.contrib.auth import get_user_model
from django.utils import timezone
from .testCases import RelayTestCase, DefaultTestCase
from graphql_auth.constants import Messages
class VerifyTokenTestCaseMixin:
def setUp(self):
self.user = self.register_user(
email="foo@email.com", username="... | executed["token"]) | self.assertTrue | complex_expr | tests/test_verify_token.py | test_verify_token | VerifyTokenTestCaseMixin | 18 | null |
PedroBern/django-graphql-auth | from pytest import mark
from django.contrib.auth import get_user_model
from .testCases import RelayTestCase, DefaultTestCase
from .decorators import skipif_django_21
from graphql_auth.constants import Messages
class UpdateAccountTestCaseMixin:
def setUp(self):
self.user1 = self.register_user(
... | "firstname") | self.assertEqual | string_literal | tests/test_update_account.py | test_update_account | UpdateAccountTestCaseMixin | 39 | null |
PedroBern/django-graphql-auth | from smtplib import SMTPException
from unittest import mock
from .testCases import RelayTestCase, DefaultTestCase
class SendSecondaryEmailActivationTestCaseMixin:
def setUp(self):
self.user1 = self.register_user(
email="gaa@email.com", username="gaa", verified=False
)
self.user... | executed["errors"]) | self.assertTrue | complex_expr | tests/test_send_secondary_email_activation.py | test_not_verified_user | SendSecondaryEmailActivationTestCaseMixin | 20 | null |
PedroBern/django-graphql-auth | from django.contrib.auth import get_user_model
from .testCases import RelayTestCase, DefaultTestCase
from graphql_auth.constants import Messages
from graphql_auth.utils import get_token, get_token_payload
from graphql_auth.models import UserStatus
from graphql_auth.signals import user_verified
class VerifyAccountCase... | Messages.ALREADY_VERIFIED) | self.assertEqual | complex_expr | tests/test_verify_account.py | test_verified_user | VerifyAccountCaseMixin | 38 | null |
PedroBern/django-graphql-auth | import django
from pytest import mark
from django.contrib.auth import get_user_model
from django.core.exceptions import ObjectDoesNotExist
from django.conf import settings
from .testCases import RelayTestCase, DefaultTestCase
from .decorators import skipif_django_21
from graphql_auth.constants import Messages
from g... | Messages.UNAUTHENTICATED) | self.assertEqual | complex_expr | tests/test_delete_account.py | test_not_authenticated | DeleteAccountTestCaseMixin | 29 | null |
PedroBern/django-graphql-auth | import django
from pytest import mark
from django.contrib.auth import get_user_model
from django.core.exceptions import ObjectDoesNotExist
from django.conf import settings
from .testCases import RelayTestCase, DefaultTestCase
from .decorators import skipif_django_21
from graphql_auth.constants import Messages
from g... | Messages.NOT_VERIFIED) | self.assertEqual | complex_expr | tests/test_delete_account.py | test_not_verified_user | DeleteAccountTestCaseMixin | 66 | null |
PedroBern/django-graphql-auth | from unittest import skip
from django.contrib.auth import get_user_model
from django.utils import timezone
from .testCases import RelayTestCase, DefaultTestCase
from graphql_auth.constants import Messages
class RevokeTokenTestCaseMixin:
def setUp(self):
self.user1 = self.register_user(email="foo@email.co... | executed["revoked"]) | self.assertTrue | complex_expr | tests/test_revoke_token.py | test_revoke_token | RevokeTokenTestCaseMixin | 27 | null |
protectai/llm-guard | import pytest
from llm_guard.output_scanners.sensitive import Sensitive
@pytest.mark.parametrize(
"output,expected_output,expected_valid,expected_score",
[
(
"Sorry, I can't",
"Sorry, I can't",
True,
-1.0,
), # No sensitive information
(... | expected_output | assert | variable | tests/output_scanners/test_sensitive.py | test_scan | 26 | null | |
protectai/llm-guard | import pytest
from llm_guard.input_scanners.secrets import Secrets
@pytest.mark.parametrize(
"prompt,expected_prompt,expected_valid,expected_score",
[
(
"Just a simple prompt",
"Just a simple prompt",
True,
-1.0,
), # Prompt without sensitive da... | expected_prompt | assert | variable | tests/input_scanners/test_secrets.py | test_scan | 52 | null | |
protectai/llm-guard | import pytest
from llm_guard.output_scanners.language_same import LanguageSame
@pytest.mark.parametrize(
"prompt,output,expected_valid,expected_score",
[
(
"Describe me a random book",
"This book is about testing, experimenting, and playing with language. It is a handbook of to... | expected_score | assert | variable | tests/output_scanners/test_language_same.py | test_scan | 28 | null | |
protectai/llm-guard | import pytest
from llm_guard.input_scanners.secrets import Secrets
@pytest.mark.parametrize(
"prompt,expected_prompt,expected_valid,expected_score",
[
(
"Just a simple prompt",
"Just a simple prompt",
True,
-1.0,
), # Prompt without sensitive da... | expected_valid | assert | variable | tests/input_scanners/test_secrets.py | test_scan | 53 | null | |
protectai/llm-guard | import pytest
from llm_guard import scan_output, scan_prompt
from llm_guard.input_scanners import BanSubstrings, TokenLimit
from llm_guard.input_scanners.ban_substrings import MatchType as BanSubstringsMatchType
from llm_guard.output_scanners import (
BanTopics,
Deanonymize,
Gibberish,
NoRefusal,
R... | expected_sanitized_output | assert | variable | tests/test_evaluate.py | test_scan_output | 104 | null | |
protectai/llm-guard | import pytest
from llm_guard.output_scanners.relevance import Relevance
@pytest.mark.parametrize(
"prompt,output,expected_valid,expected_score",
[
("", "", True, -1.0), # Empty prompt
(
"brainstorm 3 names for a child",
"Aria Solstice, Orion Lark, Seraphina Wren",
... | expected_score | assert | variable | tests/output_scanners/test_relevance.py | test_scan | 30 | null | |
protectai/llm-guard | import pytest
from llm_guard.output_scanners.language import Language
@pytest.mark.parametrize(
"output,expected_valid,expected_score",
[
("Just an output", True, -1.0), # Correct output
(
"Me llamo Sofia. ¿Cómo te llamas?",
False,
1.0,
), # Spanis... | output | assert | variable | tests/output_scanners/test_language.py | test_scan | 23 | null | |
protectai/llm-guard | import pytest
from llm_guard.input_scanners.secrets import Secrets
@pytest.mark.parametrize(
"prompt,expected_prompt,expected_valid,expected_score",
[
(
"Just a simple prompt",
"Just a simple prompt",
True,
-1.0,
), # Prompt without sensitive da... | expected_score | assert | variable | tests/input_scanners/test_secrets.py | test_scan | 54 | null | |
protectai/llm-guard | import pytest
from llm_guard.output_scanners.emotion_detection import EmotionDetection
def test_scan_default_blocked_emotions():
"""Test that the scanner uses default blocked emotions when none specified."""
scanner = EmotionDetection(threshold=0.5)
# Should block negative emotions by default
output =... | 0.0 | assert | numeric_literal | tests/output_scanners/test_emotion_detection.py | test_scan_default_blocked_emotions | 49 | null | |
protectai/llm-guard | import pytest
from llm_guard.output_scanners.code import Code
@pytest.mark.parametrize(
"output,expected_valid,expected_score",
[
("", True, -1.0), # Empty prompt
(
"""Sure! Here's a simple JavaScript function that returns "Hello, World!":
```js
function sayHello() {
return "... | output | assert | variable | tests/output_scanners/test_code.py | test_scan | 66 | null | |
protectai/llm-guard | import pytest
from llm_guard.input_scanners.invisible_text import InvisibleText
def convert_to_tag_chars(input_string: str):
return "".join(chr(0xE0000 + ord(ch)) for ch in input_string)
@pytest.mark.parametrize(
"prompt,expected_prompt,expected_valid,expected_score",
[
("Just a simple prompt", "... | expected_valid | assert | variable | tests/input_scanners/test_invisible_text.py | test_scan | 82 | null | |
protectai/llm-guard | import pytest
from llm_guard.util import (
calculate_risk_score,
chunk_text,
extract_urls,
remove_markdown,
split_text_by_sentences,
split_text_to_word_chunks,
truncate_tokens_head_tail,
)
@pytest.mark.parametrize(
"text, expected_clean_text",
[
(
"**bold** *ita... | expected_clean_text | assert | variable | tests/test_util.py | test_remove_markdown_removes_correctly | 104 | null | |
protectai/llm-guard | import pytest
from llm_guard.output_scanners.factual_consistency import FactualConsistency
@pytest.mark.parametrize(
"prompt,output,expected_valid,expected_score",
[
(
"All humans are vegetarians.",
"Many people around the world eat meat and fish as part of their diet. Therefor... | expected_valid | assert | variable | tests/output_scanners/test_factual_consistency.py | test_scan | 34 | null | |
protectai/llm-guard | import pytest
from llm_guard.output_scanners.relevance import Relevance
@pytest.mark.parametrize(
"prompt,output,expected_valid,expected_score",
[
("", "", True, -1.0), # Empty prompt
(
"brainstorm 3 names for a child",
"Aria Solstice, Orion Lark, Seraphina Wren",
... | expected_valid | assert | variable | tests/output_scanners/test_relevance.py | test_scan | 29 | null | |
protectai/llm-guard | import pytest
from llm_guard.output_scanners.emotion_detection import EmotionDetection
def test_scan_default_blocked_emotions():
"""Test that the scanner uses default blocked emotions when none specified."""
scanner = EmotionDetection(threshold=0.5)
# Should block negative emotions by default
output =... | False | assert | bool_literal | tests/output_scanners/test_emotion_detection.py | test_scan_default_blocked_emotions | 48 | null | |
protectai/llm-guard | import re
import pytest
from llm_guard.exception import LLMGuardValidationError
from llm_guard.input_scanners.anonymize import (
ALL_SUPPORTED_LANGUAGES,
DEFAULT_ENTITY_TYPES,
Anonymize,
)
from llm_guard.input_scanners.anonymize_helpers import (
BERT_BASE_NER_CONF,
BERT_LARGE_NER_CONF,
BERT_ZH... | f"Language must be in the list of allowed: {ALL_SUPPORTED_LANGUAGES}" | assert | string_literal | tests/input_scanners/test_anonymize.py | test_scan_unknown | 318 | null | |
protectai/llm-guard | import pytest
from llm_guard.input_scanners.emotion_detection import EmotionDetection
def test_scan_default_blocked_emotions():
"""Test that the scanner uses default blocked emotions when none specified."""
scanner = EmotionDetection(threshold=0.5)
# Should block negative emotions by default
prompt = ... | 0.0 | assert | numeric_literal | tests/input_scanners/test_emotion_detection.py | test_scan_default_blocked_emotions | 36 | null | |
protectai/llm-guard | import pytest
from llm_guard.input_scanners.ban_code import BanCode
@pytest.mark.parametrize(
"prompt,expected_valid,expected_score",
[
("Just a simple prompt", True, -1.0), # Simple prompt
(
"""Fix the following JS code:
function sayHello() {
return "Hello, World!";
}
consol... | expected_score | assert | variable | tests/input_scanners/test_ban_code.py | test_scan | 56 | null | |
protectai/llm-guard | import pytest
from llm_guard.output_scanners.no_refusal import MatchType, NoRefusal, NoRefusalLight
@pytest.mark.parametrize(
"output,expected_valid,expected_score",
[
(
"Sure! Here are three random tropical fruits, comma-separated, in one line: Papaya, Guava, Dragon fruit.",
T... | expected_valid | assert | variable | tests/output_scanners/test_no_refusal.py | test_scan | 78 | null | |
protectai/llm-guard | import pytest
from llm_guard.output_scanners.toxicity import Toxicity
@pytest.mark.parametrize(
"output,expected_valid,expected_score",
[
(
"As a software, I am not capable of engaging in verbal sparring or offensive behavior. It is crucial to "
"maintain a courteous and respec... | expected_valid | assert | variable | tests/output_scanners/test_toxicity.py | test_scan | 32 | null | |
protectai/llm-guard | import pytest
from llm_guard.input_scanners.emotion_detection import EmotionDetection
@pytest.mark.parametrize(
"prompt,expected_valid,check_score",
[
("Just a simple prompt", True, lambda s: s == 0.0), # Simple prompt
("I am so happy today!", True, lambda s: s == 0.0), # Positive emotion (n... | prompt | assert | variable | tests/input_scanners/test_emotion_detection.py | test_scan | 23 | null | |
protectai/llm-guard | import pytest
from llm_guard.output_scanners.factual_consistency import FactualConsistency
@pytest.mark.parametrize(
"prompt,output,expected_valid,expected_score",
[
(
"All humans are vegetarians.",
"Many people around the world eat meat and fish as part of their diet. Therefor... | expected_score | assert | variable | tests/output_scanners/test_factual_consistency.py | test_scan | 35 | null | |
protectai/llm-guard | import pytest
from llm_guard.input_scanners.language import Language, MatchType
@pytest.mark.parametrize(
"match_type,prompt,expected_valid,expected_score",
[
(MatchType.FULL, "Just a prompt", True, -1.0), # Correct output
(
MatchType.FULL,
"Me llamo Sofia. ¿Cómo te ll... | expected_valid | assert | variable | tests/input_scanners/test_language.py | test_scan | 51 | null | |
protectai/llm-guard | import pytest
from llm_guard.input_scanners.regex import MatchType, Regex
@pytest.mark.parametrize(
"prompt,expected_prompt,expected_valid,expected_score",
[
("Just a prompt", "Just a prompt", True, -1.0), # Correct output
(
"Here is my token: Bearer abc-def_123",
"Her... | expected_score | assert | variable | tests/input_scanners/test_regex.py | test_scan | 34 | null | |
protectai/llm-guard | import pytest
from llm_guard.input_scanners.sentiment import Sentiment
@pytest.mark.parametrize(
"prompt,expected_valid,expected_score",
[
("Just a simple prompt", True, 0.0), # Simple prompt
(
"I heard that Mars is the closest planet to Earth. Is that true?",
True,
... | expected_score | assert | variable | tests/input_scanners/test_sentiment.py | test_scan | 36 | null | |
protectai/llm-guard | import pytest
from llm_guard.output_scanners.json import JSON
@pytest.mark.parametrize(
"output,expected_output,expected_valid,expected_score",
[
(
"There is no JSON in this output.",
"There is no JSON in this output.",
False,
1.0,
), # No JSON
... | expected_valid | assert | variable | tests/output_scanners/test_json.py | test_scan | 73 | null | |
protectai/llm-guard | import pytest
from llm_guard.output_scanners.sensitive import Sensitive
@pytest.mark.parametrize(
"output,expected_output,expected_valid,expected_score",
[
(
"Sorry, I can't",
"Sorry, I can't",
True,
-1.0,
), # No sensitive information
(... | expected_valid | assert | variable | tests/output_scanners/test_sensitive.py | test_scan | 27 | null | |
protectai/llm-guard | import pytest
from llm_guard.input_scanners.ban_substrings import PROMPT_STOP_SUBSTRINGS, BanSubstrings
def test_scan_all():
scanner = BanSubstrings(
substrings=["one", "two"],
redact=True,
case_sensitive=False,
contains_all=True,
)
sanitized_prompt, valid, score = scanner.... | 1.0 | assert | numeric_literal | tests/input_scanners/test_ban_substrings.py | test_scan_all | 54 | null | |
protectai/llm-guard | from typing import List, Tuple
import pytest
from llm_guard.input_scanners.anonymize import Anonymize
from llm_guard.output_scanners.deanonymize import Deanonymize, MatchingStrategy
from llm_guard.vault import Vault
@pytest.mark.parametrize(
"raw_prompt,output,expected_output,expected_valid,expected_score",
... | expected_valid | assert | variable | tests/output_scanners/test_deanonymize.py | test_scan_full | 40 | null | |
protectai/llm-guard | import pytest
from llm_guard.output_scanners.language import Language
@pytest.mark.parametrize(
"output,expected_valid,expected_score",
[
("Just an output", True, -1.0), # Correct output
(
"Me llamo Sofia. ¿Cómo te llamas?",
False,
1.0,
), # Spanis... | expected_valid | assert | variable | tests/output_scanners/test_language.py | test_scan | 24 | null | |
protectai/llm-guard | import pytest
from llm_guard.output_scanners.sensitive import Sensitive
@pytest.mark.parametrize(
"output,expected_output,expected_valid,expected_score",
[
(
"Sorry, I can't",
"Sorry, I can't",
True,
-1.0,
), # No sensitive information
(... | expected_score | assert | variable | tests/output_scanners/test_sensitive.py | test_scan | 28 | null | |
protectai/llm-guard | import pytest
from llm_guard.input_scanners.gibberish import Gibberish
@pytest.mark.parametrize(
"prompt,expected_valid,expected_score",
[
("Just a simple prompt", True, -0.7), # Simple prompt
(
"dfdfer fgerfow2e0d qsqskdsd djksdnfkff swq",
False,
1.0,
... | prompt | assert | variable | tests/input_scanners/test_gibberish.py | test_scan | 25 | null |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.