<commit_before>from django.contrib.auth import get_user_model
from django.test import RequestFactory, TestCase

from admin_sso import settings
from admin_sso.auth import DjangoSSOAuthBackend
from admin_sso.models import Assignment


User = get_user_model()


class AuthModuleTests(TestCase):
    def setUp(self):
        self.auth_module = DjangoSSOAuthBackend()
        self.user = User.objects.create(username="admin_sso1")
        self.assignment1 = Assignment.objects.create(
            username="",
            username_mode=settings.ASSIGNMENT_ANY,
            domain="example.com",
            user=self.user,
            weight=100,
        )
        self.request_factory = RequestFactory()

    def tearDown(self):
        self.user.delete()
        Assignment.objects.all().delete()

    def test_empty_authenticate(self):
        request = self.request_factory.get('/')
        user = self.auth_module.authenticate(request)
        self.assertEqual(user, None)

    def test_simple_assignment(self):
        email = "<EMAIL>"
        request = self.request_factory.get('/')
        user = self.auth_module.authenticate(request, sso_email=email)
        self.assertEqual(user, self.user)

    def test_get_user(self):
        user = self.auth_module.get_user(self.user.id)
        self.assertEqual(user, self.user)<commit_msg>Update the quotes to match black's expected style<commit_after>from django.contrib.auth import get_user_model
from django.test import RequestFactory, TestCase

from admin_sso import settings
from admin_sso.auth import DjangoSSOAuthBackend
from admin_sso.models import Assignment


User = get_user_model()


class AuthModuleTests(TestCase):
    def setUp(self):
        self.auth_module = DjangoSSOAuthBackend()
        self.user = User.objects.create(username="admin_sso1")
        self.assignment1 = Assignment.objects.create(
            username="",
            username_mode=settings.ASSIGNMENT_ANY,
            domain="example.com",
            user=self.user,
            weight=100,
        )
        self.request_factory = RequestFactory()

    def tearDown(self):
        self.user.delete()
        Assignment.objects.all().delete()

    def test_empty_authenticate(self):
        request = self.request_factory.get("/")
        user = self.auth_module.authenticate(request)
        self.assertEqual(user, None)

    def test_simple_assignment(self):
        email = "<EMAIL>"
        request = self.request_factory.get("/")
        user = self.auth_module.authenticate(request, sso_email=email)
        self.assertEqual(user, self.user)

    def test_get_user(self):
        user = self.auth_module.get_user(self.user.id)
        self.assertEqual(user, self.user)
{'fraction_non_alphanumeric': 0.1, 'fraction_numerical': 0.0036900369003690036, 'mean_word_length': 2.9750733137829912, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3192922', 'n_tokens_mistral': 802, 'n_tokens_neox': 777, 'n_words': 144}