예제 #1
0
파일: test_forms.py 프로젝트: bilquist/mike
    def test_cannot_make_case_sensitive_users(self):
        form_data_1 = {
            'email':
            '*****@*****.**',
            'username':
            '******',
            'password1':
            'f823fb293f823hf',
            'password2':
            'f823fb293f823hf',
            'tos_accepted':
            True,
            'sign_up_code':
            GroomsbroCode.objects.filter(
                is_michael_hatheway=True).first().code,
        }
        form_data_2 = {
            'email':
            '*****@*****.**',
            'username':
            '******',
            'password1':
            'f823fb293f823hf',
            'password2':
            'f823fb293f823hf',
            'tos_accepted':
            True,
            'sign_up_code':
            GroomsbroCode.objects.filter(
                is_michael_hatheway=True).first().code,
        }
        form1 = MichaelHathewaySignUpForm(data=form_data_1)
        self.assertTrue(form1.is_valid())
        form1.save()
        self.assertEqual(User.objects.count(), 1)
        self.assertEqual(User.objects.first().username,
                         form_data_1['username'])

        form2 = MichaelHathewaySignUpForm(data=form_data_2)
        self.assertFalse(form2.is_valid())
        self.assertEqual(User.objects.count(), 1)
예제 #2
0
파일: test_forms.py 프로젝트: bilquist/mike
    def test_requires_sign_up_code(self):
        form_data_1 = {
            'email': '*****@*****.**',
            'username': '******',
            'password1': 'f823f111',
            'password2': 'f823f111',
            'tos_accepted': True,
        }
        form1 = MichaelHathewaySignUpForm(data=form_data_1)
        self.assertFalse(form1.is_valid())

        form_data_2 = {
            'email': '*****@*****.**',
            'username': '******',
            'password1': 'f823f111',
            'password2': 'f823f111',
            'tos_accepted': True,
            'sign_up_code': 'cat is bacon',
        }
        form2 = MichaelHathewaySignUpForm(data=form_data_2)
        self.assertFalse(form2.is_valid())
예제 #3
0
파일: test_forms.py 프로젝트: bilquist/mike
 def test_password_cannot_be_less_than_8_characters(self):
     form_data_1 = {
         'email':
         '*****@*****.**',
         'username':
         '******',
         'password1':
         'f823f',
         'password2':
         'f823f',
         'tos_accepted':
         True,
         'sign_up_code':
         GroomsbroCode.objects.filter(
             is_michael_hatheway=True).first().code,
     }
     form1 = MichaelHathewaySignUpForm(data=form_data_1)
     self.assertFalse(form1.is_valid())
예제 #4
0
파일: test_forms.py 프로젝트: bilquist/mike
 def test_must_use_preset_username(self):
     form_data_1 = {
         'email':
         '*****@*****.**',
         'username':
         '******',
         'password1':
         'f823fb293f823hf',
         'password2':
         'f823fb293f823hf',
         'tos_accepted':
         True,
         'sign_up_code':
         GroomsbroCode.objects.filter(
             is_michael_hatheway=True).first().code,
     }
     form1 = MichaelHathewaySignUpForm(data=form_data_1)
     self.assertFalse(form1.is_valid())
예제 #5
0
파일: test_forms.py 프로젝트: bilquist/mike
 def test_must_accept_tos(self):
     form_data = {
         'email':
         '*****@*****.**',
         'username':
         GroomsbroCode.objects.filter(
             is_michael_hatheway=True).first().username,
         'password1':
         'asfd923280',
         'password2':
         'asfd923280',
         'tos_accepted':
         False,
         'sign_up_code':
         GroomsbroCode.objects.filter(
             is_michael_hatheway=True).first().code,
     }
     form = MichaelHathewaySignUpForm(data=form_data)
     self.assertFalse(form.is_valid())