def test_utf8_answer(self): value = get_form_question_values( {'form': { 'foo': { 'bar': b'b\xc4\x85z' } }}) self.assertEqual(value, {'/data/foo/bar': b'b\xc4\x85z'})
def test_unicode_answer(self): value = get_form_question_values( {'form': { 'foo': { 'bar': u'b\u0105z' } }}) self.assertEqual(value, {'/data/foo/bar': u'b\u0105z'})
def test_unicode_question(self): value = get_form_question_values( {'form': { 'foo': { 'b\u0105r': 'baz' } }}) self.assertEqual(value, {'/data/foo/b\u0105r': 'baz'})
def test_utf8_question(self): # Form Builder questions are expected to be ASCII value = get_form_question_values( {'form': { 'foo': { b'b\xc4\x85r': 'baz' } }}) self.assertEqual(value, {u'/data/foo/b\u0105r': 'baz'})
def test_utf8_question(self): with warnings.catch_warnings(): warnings.simplefilter("ignore", UnicodeWarning) value = get_form_question_values( {'form': { 'foo': { b'b\xc4\x85r': 'baz' } }}) self.assertEqual(value, {'/data/foo/b\u0105r': 'baz'})
def fire_for_record(self, repeat_record): form_json = json.loads(self.get_payload(repeat_record)) case_trigger_infos = get_relevant_case_updates_from_form_json( self.domain, form_json, case_types=self.white_listed_case_types, extra_fields=[id_matcher.case_property for id_matcher in self.openmrs_config.case_config.id_matchers]) form_question_values = get_form_question_values(form_json) send_openmrs_data(Requests(self.url, self.username, self.password), form_json, self.openmrs_config, case_trigger_infos, form_question_values) return repeat_record.handle_success(None)
def send_request(self, repeat_record, payload, verify=None): case_trigger_infos = get_relevant_case_updates_from_form_json( self.domain, payload, case_types=self.white_listed_case_types, extra_fields=[ id_matcher.case_property for id_matcher in self.openmrs_config.case_config.id_matchers ]) form_question_values = get_form_question_values(payload) return send_openmrs_data( Requests(self.url, self.username, self.password), payload, self.openmrs_config, case_trigger_infos, form_question_values)