# Path: user_management/models/tests/utils.py
# class APIRequestTestCase(Python2AssertMixin, BaseAPIRequestTestCase):
# class RequestTestCase(Python2AssertMixin, BaseRequestTestCase):
# 
# Path: user_management/utils/notifications.py
# def validation_email_context(notification):
#     """Email context to verify a user email."""
#     return {
#         'protocol': 'https',
#         'token': notification.user.generate_validation_token(),
#         'site': notification.site,
#     }
# 
# Path: user_management/models/tests/factories.py
# class UserFactory(factory.DjangoModelFactory):
#     name = factory.Sequence('Test User {}'.format)
#     email = factory.Sequence('email{}@example.com'.format)
#     is_active = True
# 
#     class Meta:
#         model = get_user_model()
# 
#     @factory.post_generation
#     def password(self, create, extracted='default password', **kwargs):
#         self.raw_password = extracted
#         self.set_password(self.raw_password)
#         if create:
#             self.save()


from django.contrib.sites.models import Site
from django.core import checks
from django.db.models import TextField
from django.db.utils import IntegrityError
from django.test import TestCase
from django.utils import timezone
from mock import Mock, patch
from user_management.models.tests import utils
from user_management.utils.notifications import validation_email_context
from . import models
from .factories import UserFactory
from .. import mixins
        self.assertCountEqual(fields, expected)

    def test_str(self):
        """Does "User.__str__()" work as expected?"""
        expected = 'Leopold Stotch'
        user = self.model(name=expected)
        self.assertEqual(str(user), expected)

    def test_name_methods(self):
        """Do "User.get_full_name()" & "get_short_name()" work as expected?"""
        expected = 'Professor Chaos'
        user = self.model(name=expected)
        self.assertEqual(user.get_full_name(), expected)
        self.assertEqual(user.get_short_name(), expected)

    def test_case_insensitive_uniqueness(self):
        self.model(email='CAPS@example.com').save()
        with self.assertRaises(IntegrityError):
            self.model(email='caps@example.com').save()


class TestUserManager(TestCase):
    manager = models.User.objects

    def test_create_user_without_email(self):
        with self.assertRaises(ValueError):
            self.manager.create_user(email='')
        self.assertFalse(self.manager.count())

    def test_create_duplicate_email(self):

# Path: user_management/models/tests/utils.py
# class APIRequestTestCase(Python2AssertMixin, BaseAPIRequestTestCase):
# class RequestTestCase(Python2AssertMixin, BaseRequestTestCase):
# 
# Path: user_management/utils/notifications.py
# def validation_email_context(notification):
#     """Email context to verify a user email."""
#     return {
#         'protocol': 'https',
#         'token': notification.user.generate_validation_token(),
#         'site': notification.site,
#     }
# 
# Path: user_management/models/tests/factories.py
# class UserFactory(factory.DjangoModelFactory):
#     name = factory.Sequence('Test User {}'.format)
#     email = factory.Sequence('email{}@example.com'.format)
#     is_active = True
# 
#     class Meta:
#         model = get_user_model()
# 
#     @factory.post_generation
#     def password(self, create, extracted='default password', **kwargs):
#         self.raw_password = extracted
#         self.set_password(self.raw_password)
#         if create:
#             self.save()


# Path: user_management/models/tests/test_models.py
from django.contrib.sites.models import Site
from django.core import checks
from django.db.models import TextField
from django.db.utils import IntegrityError
from django.test import TestCase
from django.utils import timezone
from mock import Mock, patch
from user_management.models.tests import utils
from user_management.utils.notifications import validation_email_context
from . import models
from .factories import UserFactory
from .. import mixins

        self.assertCountEqual(fields, expected)

    def test_str(self):
        """Does "User.__str__()" work as expected?"""
        expected = 'Leopold Stotch'
        user = self.model(name=expected)
        self.assertEqual(str(user), expected)

    def test_name_methods(self):
        """Do "User.get_full_name()" & "get_short_name()" work as expected?"""
        expected = 'Professor Chaos'
        user = self.model(name=expected)
        self.assertEqual(user.get_full_name(), expected)
        self.assertEqual(user.get_short_name(), expected)

    def test_case_insensitive_uniqueness(self):
        self.model(email='CAPS@example.com').save()
        with self.assertRaises(IntegrityError):
            self.model(email='caps@example.com').save()


class TestUserManager(TestCase):
    manager = models.User.objects

    def test_create_user_without_email(self):
        with self.assertRaises(ValueError):
            self.manager.create_user(email='')
        self.assertFalse(self.manager.count())

    def test_create_duplicate_email(self):

        existing_user = UserFactory.create()