Beispiel #1
0
 def test_compress_with_nothing(self):
     f = MathCaptchaField()
     result = f.compress([])
     self.assertIsNone(result)
Beispiel #2
0
 def test_compress_with_wrong_answer(self):
     f = MathCaptchaField()
     with mock.patch('simplemathcaptcha.fields.hash_answer') as mocked:
         mocked.return_value = 'bad_hashed_answer'
         with self.assertRaises(ValidationError):
             f.compress(['abc', 'hashed_answer'])
Beispiel #3
0
 def test_compress(self):
     f = MathCaptchaField()
     with mock.patch('simplemathcaptcha.fields.hash_answer') as mocked:
         mocked.return_value = 'hashed_answer'
         result = f.compress(['abc', 'hashed_answer'])
         self.assertIsNone(result)
 def test_compress_with_nothing(self):
     f = MathCaptchaField()
     result = f.compress([])
     self.assertIsNone(result)
 def test_compress_with_wrong_answer(self):
     f = MathCaptchaField()
     with mock.patch('simplemathcaptcha.fields.hash_answer') as mocked:
         mocked.return_value = 'bad_hashed_answer'
         with self.assertRaises(ValidationError):
             f.compress(['abc', 'hashed_answer'])
 def test_compress(self):
     f = MathCaptchaField()
     with mock.patch('simplemathcaptcha.fields.hash_answer') as mocked:
         mocked.return_value = 'hashed_answer'
         result = f.compress(['abc', 'hashed_answer'])
         self.assertIsNone(result)