示例#1
0
    def test_login_form_invalid(self):
        """
        When provided with incorrect username or password the form
        should not validate.
        """
        form = LoginForm(data={'username': '******', 'password': '******'})
        self.assertFalse(form.is_valid())

        form = LoginForm(data={'username': '******', 'password': '******'})
        self.assertFalse(form.is_valid())
示例#2
0
    def test_login_form_invalid(self):
        """
        When provided with incorrect username or password the form
        should not validate.
        """
        form = LoginForm(data={'username': '******', 'password': '******'})
        self.assertFalse(form.is_valid())

        form = LoginForm(data={'username': '******', 'password': '******'})
        self.assertFalse(form.is_valid())
示例#3
0
 def test_login_form(self):
     """
     When provided with correct data, the form should validate.
     """
     form = LoginForm(data={'username': '******',
                            'password': '******'})
     self.assertTrue(form.is_valid())
示例#4
0
 def test_login_form_exception(self):
     """
     If an authentication backend raises an exception, the
     exception should be handled and the form should be invalid.
     """
     form = LoginForm(data={'username': '******', 'password': '******'})
     self.assertFalse(form.is_valid())
示例#5
0
 def test_login_form_empty(self):
     """
     When no username or password is provided, the form should
     not validate.
     """
     form = LoginForm(data={'username': '', 'password': ''})
     self.assertFalse(form.is_valid())
示例#6
0
 def test_login_form_exception(self):
     """
     If an authentication backend raises an exception, the
     exception should be handled and the form should be invalid.
     """
     form = LoginForm(data={'username': '******', 'password': '******'})
     self.assertFalse(form.is_valid())
示例#7
0
 def test_login_form_empty(self):
     """
     When no username or password is provided, the form should
     not validate.
     """
     form = LoginForm(data={'username': '', 'password': ''})
     self.assertFalse(form.is_valid())
 def test_login_form_inactive(self):
     """
     When provided with an inactive user, the form should be invalid.
     """
     InactiveUserFactory()
     form = LoginForm(data={'username': '******', 'password': '******'})
     self.assertFalse(form.is_valid())
示例#9
0
 def test_login_form_inactive(self):
     """
     When provided with an inactive user, the form should be invalid.
     """
     InactiveUserFactory()
     form = LoginForm(data={'username': '******', 'password': '******'})
     self.assertFalse(form.is_valid())
示例#10
0
 def test_login_case_insensitive(self):
     """
     If a case-insensitive authentication backend is in use,
     authentication should proceed as expected when the case differs.
     """
     UserFactory(first_name='John', last_name='Phillips')
     form = LoginForm(data={'username': '******', 'password': '******'})
     self.assertTrue(form.is_valid())
示例#11
0
 def test_login_case_insensitive(self):
     """
     If a case-insensitive authentication backend is in use,
     authentication should proceed as expected when the case differs.
     """
     UserFactory(first_name='John', last_name='Phillips')
     form = LoginForm(data={'username': '******', 'password': '******'})
     self.assertTrue(form.is_valid())
示例#12
0
 def test_login_form_username(self):
     """
     When a mixed-case username is provided, it should be converted
     to lowercase.
     """
     form = LoginForm(data={'username': '******',
                            'password': '******'})
     self.assertTrue(form.is_valid())
     self.assertEqual(form.cleaned_data['username'], 'ellen')
示例#13
0
 def test_login_form_inactive(self):
     """
     When provided with an inactive user, the form should not
     validate.
     """
     self.user.is_active = False
     self.user.save()
     form = LoginForm(data={'username': '******',
                            'password': '******'})
     self.assertFalse(form.is_valid())
示例#14
0
 def test_login_form(self):
     """
     When provided with correct data, the form should validate.
     """
     form = LoginForm(data={'username': '******', 'password': '******'})
     self.assertTrue(form.is_valid())