def test_all_sections_complete_no_blocks_completed(self): schema = load_schema_from_params('test', 'navigation_completeness') routing_path = [ Location('coffee-group', 0, 'coffee'), Location('coffee-group', 0, 'response-yes'), ] progress = Completeness(schema, AnswerStore(), [], routing_path, metadata={}) self.assertFalse(progress.all_sections_complete())
def test_only_question_blocks_counted_for_completeness(self): schema_data = { 'sections': [{ 'id': 'section_1', 'groups': [{ 'id': 'group_1', 'blocks': [ { 'id': 'question-block', 'type': 'Question', 'questions': [{ 'id': 'question', 'title': 'foo', 'type': 'general', 'answers': [] }] }, { 'id': 'interstitial-block', 'type': 'Interstitial', 'questions': [{ 'id': 'interstitial-question', 'title': 'bar', 'type': 'general', 'answers': [] }] } ] }] }] } schema = QuestionnaireSchema(schema_data) completed_blocks = [ Location('group_1', 0, 'question-block'), ] routing_path = [ Location('group_1', 0, 'question-block'), Location('group_1', 0, 'interstitial-block'), ] progress = Completeness( schema, AnswerStore(), completed_blocks, routing_path, metadata={}) self.assertEqual(Completeness.COMPLETED, progress.get_state_for_group('group_1')) self.assertEqual(Completeness.COMPLETED, progress.get_state_for_section('section_1')) self.assertTrue(progress.all_sections_complete())