def get_next_page(test_id, page_id): """Determines the next test page. Either the next page in the test that has questions, or 0 - meaning the results page. :param page_id: id of the testing_app.models.Page :param test_id: if of the testing_app.models.Test """ return Test.get_next_page_for(test_id, page_id)
def test_get_to_next_page(self): first_page_path = reverse('pages', kwargs={'test_id': self.test1.id, 'page_id': self.t1_page1.id}) first_page_answers = { str(self.t1_p1_question1.as_form_id()): str( self.t1_p1_q1_answer1.id)} response = self.client.post(first_page_path, first_page_answers, follow=True) next_page_id = Test.get_next_page_for(self.test1.id, self.t1_page1.id) next_page_path = reverse('pages', kwargs={'test_id': self.test1.id, 'page_id': next_page_id}) self.assertRedirects(response, next_page_path)