from django.test import TestCase
from django import forms

from accounts.models import CustomUser
from accounts.forms import UserCreationForm


class AccountsFormsTest(TestCase):

    def test_valid_user_registration_form(self):
        form = UserCreationForm({
            'email': '<EMAIL>',
            'name': 'Test User',
            'password1': '<PASSWORD>',
            'password2': '<PASSWORD>',
        })

        self.assertTrue(form.is_valid())


    def test_invalid_user_registration_form(self):
        form = UserCreationForm({
            'email': '<EMAIL>',
            'name': 'Test User',
            'password1': '<PASSWORD>',
        })

        self.assertFalse(form.is_valid())


    def test_arise_password_dont_match(self):
        form = UserCreationForm({
            'email': '<EMAIL>',
            'name': 'Test User',
            'password1': '<PASSWORD>',
            'password2': '<PASSWORD>',
        })

        self.assertFalse(form.is_valid())
from django.test import TestCase
from django import forms

from accounts.models import CustomUser
from accounts.forms import UserCreationForm


class AccountsFormsTest(TestCase):

    def test_valid_user_registration_form(self):
        form = UserCreationForm({
            'email': '<EMAIL>',
            'name': 'Test User',
            'password1': '<PASSWORD>',
            'password2': '<PASSWORD>',
        })

        self.assertTrue(form.is_valid())


    def test_invalid_user_registration_form(self):
        form = UserCreationForm({
            'email': '<EMAIL>',
            'name': 'Test User',
            'password1': '<PASSWORD>',
        })

        self.assertFalse(form.is_valid())


    def test_arise_password_dont_match(self):
        form = UserCreationForm({
            'email': '<EMAIL>',
            'name': 'Test User',
            'password1': '<PASSWORD>',
            'password2': '<PASSWORD>',
        })

        self.assertFalse(form.is_valid())