@unittest.skipIf(settings.AUTH_USER_MODEL != 'auth.User', 'Custom user model is not supported for this test')
    def test_modern_signin(self):

        # username is too long
        if DJANGO_VERSION < (1, 5, 0):
            self._regenerate_email(200)
            response = self._login()
            self.assertEqual(response.status_code, 200)
            self.assertFormError(response, 'signin_form', 'username', 'Ensure this value has at most 30 characters'
                                                                      ' (it has %s).' % len(self._email))

        self._regenerate_email()

        # login with wrong credentials
        response = self._login()
        self.assertEqual(response.status_code, 200)

        if DJANGO_VERSION >= (1, 5, 0):  # 1.4 has html markup in actual errors description
            self.assertFormError(response, 'signin_form', None, 'Please enter a correct username and password. '
                                                                'Note that both fields may be case-sensitive.')

        # create deactivated test user
        response = self._register_user()
        self.assertRedirects(response, reverse('ok'))
        response = self._login()
        self.assertFormError(response, 'signin_form', None, 'This account is inactive.')

        # activate user and try to login again
        get_user_model().objects.filter(username=self._username).update(is_active=True)
        response = self._login()
        self.assertRedirects(response, reverse('ok'))

        # how about to login when user is already signed in?
        response = self._login()
        self.assertRedirects(response, reverse('fail'))
        self.client.logout()

        # more than one user with this e-mail
        get_user_model().objects.create(username='dummy', email=self._email)
        response = self._login()
        self.assertFormError(response, 'signin_form', None, 'There is more than one user with this e-mail. '
                                                            'Please use your username to log in.')
dataset/ETHPy150Open idlesign/django-sitegate/sitegate/tests.py/ViewsTest.test_modern_signin/original