def get_case_property_updates(test, domain):
     if (test.get_case_property('datamigration_tu_name_at_request') == 'yes'
             or test.get_case_property('migration_created_case') == 'true'
             or test.get_case_property('tu_name_at_request')):
         return {}
     else:
         form_data = get_test_created_form(test)
         tu_name_at_request = get_form_path(['person', 'tu_name'],
                                            form_data)
         if tu_name_at_request:
             return {
                 'tu_name_at_request': tu_name_at_request,
             }
         else:
             return {}
    def get_case_property_updates(test, domain):
        if (test.get_case_property(DATAMIGRATION_CASE_PROPERTY) == 'yes'
                or test.get_case_property(REFERRING_FACILITY_ID)):
            return {}

        form_data_requesting_test = get_test_created_form(test)
        referring_facility_id = get_form_path(
            ['ql_referring_facility_details', 'referring_facility_id'],
            form_data_requesting_test)
        if not referring_facility_id:
            return {}

        update = {
            REFERRING_FACILITY_ID: referring_facility_id,
        }
        try:
            referring_facility_name = SQLLocation.objects.get(
                domain=domain,
                location_id=referring_facility_id,
            ).name
            update[REFERRING_FACILITY_SAVED_NAME] = referring_facility_name
        except SQLLocation.DoesNotExist:
            pass
        return update