def test_teacher_page_can_process_a_POST_request_and_return_vote_page(self): request = HttpRequest() request.method = 'POST' request.POST['id_vote_number'] = 'A new vote' response = teacher_page(request) self.assertIn('A new vote', response.content.decode()) expected_html=render_to_string( 'vote_page.html',{'id_vote_number': 'A new vote'}) self.assertEqual(response.content.decode(), expected_html)
def test_view_teacher_page_function_returns_essential_html(self): response=teacher_page(HttpRequest()) expected=render_to_string('teacher_page.html') self.assertEqual(response.content.decode(),expected)