def test_render(self): w = MathCaptchaWidget() with mock.patch.object(w, 'generate_captcha') as mock_generate_captcha: mock_generate_captcha.return_value = 'hashed_answer' w.question_html = 'question_html' result = w.render('foo', None) self.assertHTMLEqual(result, """ <span class="captcha-question">question_html</span> <input type="text" name="foo_0" size="5" /> <input type="hidden" name="foo_1" value="hashed_answer"/>""")
def test_render(self): w = MathCaptchaWidget() with mock.patch.object(w, 'generate_captcha') as mock_generate_captcha: mock_generate_captcha.return_value = 'hashed_answer' w.question_html = 'question_html' result = w.render('foo', None) self.assertHTMLEqual( result, """ <span class="captcha-question">question_html</span> <input type="text" name="foo_0" size="5" /> <input type="hidden" name="foo_1" value="hashed_answer"/>""")
def test_format_output(self): w = MathCaptchaWidget() w.question_html = 'abc' result = w.format_output(['def', 'hij']) self.assertEqual(result, 'abcdefhij')
def test_format_output(self): w = MathCaptchaWidget() w.question_html = 'abc' result = w.format_output(['def', 'hij']) self.assertEqual(result, 'abcdefhij')