<reponame>wakaflorien/cst-research-api
from django.contrib.auth import get_user_model
from django.test import TestCase

# Create your tests here.
class UsersCreationTests(TestCase):
    def test_save(self):
        User = get_user_model()
        user = User.objects.create_user(email='<EMAIL>', password='<PASSWORD>')
        self.assertEqual(user.email, '<EMAIL>')

        try:
            self.assertIsNone(user.username)
        except AttributeError:
            pass
        with self.assertRaises(TypeError):
            User.objects.create_user()
        with self.assertRaises(TypeError):
            User.objects.create_user(email='')
        with self.assertRaises(ValueError):
            User.objects.create_user(email='', password='<PASSWORD>')
