def test_build_questionnaire_model(self): state_item = StateBlock("1", None) with patch('app.templating.metadata_template_preprocessor.get_metadata', return_value=TestBuildModel.metadata), \ patch('app.templating.metadata_template_preprocessor.to_date', return_value=datetime.datetime.now()): render_data = build_questionnaire_model(self.schema_json, state_item) self.assertIsNotNone(render_data) self.assertEqual(state_item, render_data['content']) self.assertIsNotNone(render_data['meta'])
def get_rendering_context(self, location, is_valid=True): if is_valid: if location == 'summary': return self.get_summary_rendering_context() else: # apply page answers? self.build_state(location, get_answers(current_user)) if self.state: self._plumbing_preprocessing() self._conditional_display(self.state) # look up the preprocessor and then build the view data return build_questionnaire_model(self._json, self.state)