Exemple #1
0
 def test_success(self):
     u'''ログイン成功'''
     self._sign_up()
     form = ProfiledUserOnlyAuthenticationForm(data={
         'username': self._username,
         'password': self._password,
     })
     form.is_valid()
     self.assertTrue(form.is_valid())
Exemple #2
0
    def test_failures(self):
        u'''ログイン失敗各種'''
        self._sign_up()

        form = ProfiledUserOnlyAuthenticationForm(data={
            'username': '******',
            'password': self._password,
        })
        self.assertFalse(form.is_valid())

        form = ProfiledUserOnlyAuthenticationForm(data={
            'username': self._username,
            'password': '******',
        })
        self.assertFalse(form.is_valid())

        # UserProfile無しのユーザはログイン不可
        profileless_username = '******'
        profileless_password = '******'
        User.objects.create_user(
            profileless_username, password=profileless_password)
        form = ProfiledUserOnlyAuthenticationForm(data={
            'username': profileless_username,
            'password': profileless_password,
        })
        self.assertFalse(form.is_valid())