<reponame>GDGSNF/My-Business
from django.test import TestCase

from accounts.models import Account


class AccountsManagersTestCase(TestCase):
    def test_create_user(self):
        """Check create_user successful"""
        Account.objects.create_user(email="<EMAIL>", password="<PASSWORD>")

    def test_create_user_email_incorrect(self):
        """Check create_user fail (no email)"""
        self.assertRaises(
            ValueError, Account.objects.create_user, email="", password="<PASSWORD>"
        )

    def test_create_superuser(self):
        """Check create_superuser successful"""
        Account.objects.create_superuser(
            email="<EMAIL>", password="<PASSWORD>"
        )

    def test_create_superuser_is_incorrect(self):
        """Check create_superuser fail (no email)"""
        self.assertRaises(
            ValueError, Account.objects.create_superuser, email="", password="<PASSWORD>"
        )

    def test_create_superuser_incorrect(self):
        """Check create_superuser fail (is_superuser=False)"""
        self.assertRaises(
            ValueError,
            Account.objects.create_superuser,
            email="<EMAIL>",
            password="<PASSWORD>",
            is_superuser=False,
        )
