def testReporXFormtQuery(self): unknown_terms = ['form.num_using_fp.#text', 'form.num_using_fp.@concept_id', 'form.counseling.sanitation_counseling.handwashing_importance', 'form.counseling.bednet_counseling.wash_bednet', 'form.prev_location_code', 'member_available.#text', 'location_code_1'] unknown_terms_query = report_term_filter(unknown_terms, REPORT_XFORM_MAPPING) manually_set = ['%s.%s' % (x, VALUE_TAG) for x in unknown_terms] self.assertEqual(manually_set, unknown_terms_query) known_terms = [ 'initial_processing_complete', 'doc_type', 'app_id', 'xmlns', '@uiVersion', '@version', 'form.#type', 'form.@name', 'form.meta.timeStart', 'form.meta.timeEnd', 'form.meta.appVersion', ] # shoot, TODO, cases are difficult to escape the VALUE_TAG term due to dynamic templates known_terms_query = report_term_filter(known_terms, REPORT_XFORM_MAPPING) self.assertEqual(known_terms_query, known_terms)
def testReportCaseQuery(self): unknown_terms = ['gender', 'notes', 'sms_reminder', 'hamlet_name', 'actions.dob', 'actions.dots', 'actions.hp'] unknown_terms_query = report_term_filter(unknown_terms, REPORT_CASE_MAPPING) manually_set = ['%s.%s' % (x, VALUE_TAG) for x in unknown_terms] self.assertEqual(manually_set, unknown_terms_query) known_terms = ['owner_id', 'domain', 'opened_on', 'actions.action_type', 'actions.date', 'actions.indices.doc_type'] known_terms_query = report_term_filter(known_terms, REPORT_CASE_MAPPING) self.assertEqual(known_terms_query, known_terms)
def testReportCaseQuery(self): unknown_terms = ['gender', 'notes', 'sms_reminder', 'hamlet_name', 'actions.dob', 'actions.dots', 'actions.hp'] unknown_terms_query = report_term_filter(unknown_terms, REPORT_CASE_MAPPING) manually_set = ['%s.%s' % (x, VALUE_TAG) for x in unknown_terms] self.assertEqual(manually_set, unknown_terms_query) known_terms = ['owner_id', 'domain', 'opened_on', 'actions.action_type', 'actions.date', 'actions.indices.doc_type'] known_terms_query = report_term_filter(known_terms, REPORT_CASE_MAPPING) self.assertEqual(known_terms_query, known_terms)