def test_get_user_returns_none_if_auth_failed(self): form = EntreeAuthForm(data=dict(username=self.username, password='******' % self.password)) form.is_valid() assert_equals(None, form.get_user())
def test_auth_form_clean(self): data = {'username': self.username, 'password': self.password} form = EntreeAuthForm(data=data) assert_equals(True, form.is_valid()) assert_equals(self.username, str(form.cleaned_data['username'])) assert_equals(self.password, str(form.cleaned_data['password']))
def test_get_user_returns_user(self): form = EntreeAuthForm( data=dict(username=self.username, password=self.password)) form.is_valid() assert_equals(self.user, form.get_user())
def test_auth_form_bad_password(self): data = {'username': self.username, 'password': '******' % self.password} form = EntreeAuthForm(data=data) form.is_valid() #TODO - better assert assert_equals(['__all__'], form.errors.keys())
def test_auth_form_bad_password(self): data = { 'username': self.username, 'password': '******' % self.password } form = EntreeAuthForm(data=data) form.is_valid() #TODO - better assert assert_equals(['__all__'], form.errors.keys())
def test_missing_session_middleware_raises(self): mck = Mock() mck.return_value = False request = HttpRequest() request.session = Mock() request.session.test_cookie_worked = lambda: False form = EntreeAuthForm(request=request, data=dict(username=self.username, password=self.password)) form.is_valid() #TODO - better assert assert_equals(['__all__'], form.errors.keys())
def test_get_user_returns_user(self): form = EntreeAuthForm(data=dict(username=self.username, password=self.password)) form.is_valid() assert_equals(self.user, form.get_user())