Exemple #1
0
 def test_error_anonymous_bad_tuber_and_sprout(self):
     form = PotatoCaptchaForm({}, request=self.request)
     eq_(form.is_valid(), False)
Exemple #2
0
 def test_success_anonymous(self):
     data = {'tuber': '', 'sprout': 'potato'}
     form = PotatoCaptchaForm(data, request=self.request)
     eq_(form.is_valid(), True)
Exemple #3
0
 def test_error_anonymous_bad_sprout(self):
     data = {'tuber': 'HAMMMMMMMMMMMMM', 'sprout': ''}
     form = PotatoCaptchaForm(data, request=self.request)
     eq_(form.is_valid(), False)
Exemple #4
0
 def test_success_authenticated(self):
     self.request.user = User.objects.get(id=999)
     self.request.user.is_authenticated = lambda: True
     form = PotatoCaptchaForm({}, request=self.request)
     eq_(form.is_valid(), True)
Exemple #5
0
 def test_error_anonymous_bad_tuber_and_sprout(self):
     form = PotatoCaptchaForm({}, request=self.request)
     eq_(form.is_valid(), False)
Exemple #6
0
 def test_error_anonymous_bad_sprout(self):
     data = {'tuber': 'HAMMMMMMMMMMMMM', 'sprout': ''}
     form = PotatoCaptchaForm(data, request=self.request)
     eq_(form.is_valid(), False)
Exemple #7
0
 def test_success_anonymous(self):
     data = {'tuber': '', 'sprout': 'potato'}
     form = PotatoCaptchaForm(data, request=self.request)
     eq_(form.is_valid(), True)
Exemple #8
0
 def test_success_authenticated(self):
     self.request.user = User.objects.get(id=999)
     self.request.user.is_authenticated = lambda: True
     form = PotatoCaptchaForm({}, request=self.request)
     eq_(form.is_valid(), True)