def test_list_surveys(self): """Test the list surveys api method.""" _, question_keys = self.create_test_models(3) request = survey_messages.ListQuestionsRequest( question_type=survey_models.QuestionType.ASSIGNMENT) response = self.service.list(request) self.assertEqual(len(question_keys), len(response.questions))
def test_list_surveys_with_page(self, num_surveys, page_size): """Test the list surveys api method when a next page exists.""" i = 0 _, question_keys = self.create_test_models(num_surveys) request = survey_messages.ListQuestionsRequest( question_type=survey_models.QuestionType.ASSIGNMENT, page_size=page_size) response = self.service.list(request) while response.page_token or response.more: for question in response.questions: self.assertEqual(question.question_text, question_keys[i].get().question_text) i += 1 request.page_token = response.page_token response = self.service.list(request) self.assertEqual(i, num_surveys)