def test_get_date_range_fields(self): survey = load_schema_file("test_dates.json") error_messages = SchemaHelper.get_messages(survey) questions = SchemaHelper.get_questions_by_id(survey) from_field, to_field = get_date_range_fields( questions["date-range-question"], { 'day': '1', 'month': '01', 'year': '2016' }, error_messages) self.assertTrue(hasattr(from_field.args[0], 'day')) self.assertTrue(hasattr(from_field.args[0], 'month')) self.assertTrue(hasattr(from_field.args[0], 'year')) self.assertTrue(hasattr(to_field.args[0], 'day')) self.assertTrue(hasattr(to_field.args[0], 'month')) self.assertTrue(hasattr(to_field.args[0], 'year'))
def setUp(self): super().setUp() self.question_map = SchemaHelper.get_questions_by_id(self.schema_json)