#Non project
from django.test import TestCase
from django.urls import reverse

#Project imports
from UserEntry import urls
from UserEntry.forms import UserRegistrationForm

# Create your tests here.
class UserRegistrationFormTests(TestCase):
    #For the current implementation of UserEntry further testing is not nescassery
    #The form is generated by django
    #The nescassery check is on the addition of email and that the form works in the first place

    def test_user_registration_success(self):
        form = UserRegistrationForm(data={'username':'rqeuioqwiuoqrw',
                                          'email':'reuioqwruyqwe@example.com',
                                          'password1':'uweruiy1oui79',
                                          'password2':'uweruiy1oui79',})

        self.assertTrue(form.is_valid())



    def test_view_registration_failure_on_email_lacking_information(self):
        form = UserRegistrationForm(data={'username':'rqeuioqwiuoqrw',
                                          'email':'reuioqwruyqwe',
                                          'password1':'uweruiy1oui79',
                                          'password2':'uweruiy1oui79',})

        self.assertFalse(form.is_valid())

    def test_registration_failure_on_password_retype(self):
        form = UserRegistrationForm(data={'username':'rqeuioqwiuoqrw',
                                          'email':'reuioqwruyqwe@example.com',
                                          'password1':'uweruiy1oui79',
                                          'password2':'sadfwreqfasd',})

        self.assertFalse(form.is_valid())
