Beispiel #1
0
 def test_invalid_email_format(self):
     invalid_user = Seller(username='******',
                           password='******',
                           email='exapmle.gmail.com',
                           phone='+7-952-952-52-38')
     self.assertRaisesMessage(ValidationError,
                              'Enter a valid email address',
                              invalid_user.full_clean)
Beispiel #2
0
 def test_invalid_email_more_50_symbols(self):
     invalid_user = Seller(username='******',
                           password='******',
                           email='a' * 60 + '@gmail.com',
                           phone='+7-952-952-52-38')
     self.assertRaisesMessage(
         ValidationError, 'Ensure this value has at most 50 characters',
         invalid_user.full_clean)
Beispiel #3
0
 def test_invalid_middle_name_invalid_symbols(self):
     invalid_user = Seller(username='******',
                           password='******',
                           email='*****@*****.**',
                           phone='+7-952-952-52-38',
                           first_name='Olegovich%#^')
     self.assertRaisesMessage(ValidationError,
                              'Only alphanumeric characters are allowed',
                              invalid_user.full_clean)
Beispiel #4
0
 def test_invalid_middle_name_more_150_symbols(self):
     invalid_user = Seller(username='******',
                           password='******',
                           email='*****@*****.**',
                           phone='+7-952-952-52-38',
                           first_name='Olegovich' + 'a' * 150)
     self.assertRaisesMessage(
         ValidationError, 'Ensure this value has at most 150 characters',
         invalid_user.full_clean)
Beispiel #5
0
 def test_string_representation(self):
     seller = Seller(username='******',
                     password='******',
                     email='*****@*****.**',
                     phone='+7-952-952-52-38',
                     first_name='Andrei',
                     last_name='Borodin',
                     middle_name='Olegovich')
     self.assertEqual(
         str(seller),
         'Borodin Andrei Olegovich [borodin_a_o, [email protected], +7-952-952-52-38]'
     )
Beispiel #6
0
    def test_valid_data(self):
        seller = Seller(username='******',
                        password='******',
                        email='*****@*****.**',
                        phone='+7-952-952-52-38',
                        first_name='Andrei',
                        last_name='Borodin',
                        middle_name='Olegovich')

        self.assertEqual(seller.username, 'borodin_a_o')
        self.assertEqual(seller.password, 'password')
        self.assertEqual(seller.email, '*****@*****.**')
        self.assertEqual(seller.phone, '+7-952-952-52-38')
        self.assertEqual(seller.first_name, 'Andrei')
        self.assertEqual(seller.last_name, 'Borodin')
        self.assertEqual(seller.middle_name, 'Olegovich')