<commit_before>from django.test import TestCase

from kolibri.auth.models import BaseUser, FacilityUser, DeviceOwner


class UserSanityTestCase(TestCase):
    """
    Sanity checks basic functionality of user models.
    """

    def test_facility_user(self):
        with self.assertRaises(NotImplementedError):
            BaseUser().is_device_owner()

    def test_base_user(self):
        self.assertFalse(FacilityUser(username="foo").is_device_owner())

    def test_device_admin(self):
        self.assertTrue(DeviceOwner(username="bar").is_device_owner())

    def test_short_name(self):
        self.assertEqual(FacilityUser(username="mike", first_name="Mike", last_name="Gallaspy").get_short_name(),
                         "Mike")

    def test_full_name(self):
        self.assertEqual(FacilityUser(username="mike", first_name="Mike", last_name="Gallaspy").get_full_name(),
                         "<NAME>")<commit_msg>Remove circular import<commit_after>from django.test import TestCase

# Importing user models here results in a circular import... you should use get_user_model, but then there's no
# way to get the proxy models as well. So just import at runtime.


class UserSanityTestCase(TestCase):
    """
    Sanity checks basic functionality of user models.
    """

    def test_facility_user(self):
        from kolibri.auth.models import BaseUser
        with self.assertRaises(NotImplementedError):
            BaseUser().is_device_owner()

    def test_base_user(self):
        from kolibri.auth.models import FacilityUser
        self.assertFalse(FacilityUser(username="foo").is_device_owner())

    def test_device_admin(self):
        from kolibri.auth.models import DeviceOwner
        self.assertTrue(DeviceOwner(username="bar").is_device_owner())

    def test_short_name(self):
        from kolibri.auth.models import FacilityUser
        self.assertEqual(FacilityUser(username="mike", first_name="Mike", last_name="Gallaspy").get_short_name(),
                         "Mike")

    def test_full_name(self):
        from kolibri.auth.models import FacilityUser
        self.assertEqual(FacilityUser(username="mike", first_name="Mike", last_name="Gallaspy").get_full_name(),
                         "<NAME>")
{'fraction_non_alphanumeric': 0.10477039679001338, 'fraction_numerical': 0.0, 'mean_word_length': 3.488, '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': '497916', 'n_tokens_mistral': 645, 'n_tokens_neox': 621, 'n_words': 129}