def test_save_transformations(): a1 = Asset(asset_type='survey', content={}) content = color_picker_asset_content() a1._standardize(content) a1._strip_empty_rows(content) a1._assign_kuids(content) form_title = a1.pop_setting(content, 'form_title') a1._autoname(content) assert 'schema' in content assert content['translations'] == [None] assert form_title == 'color picker' assert content['settings'] == {'id_string': 'colorpik'}
def test_save_transformations(): a1 = Asset(asset_type='survey', content={}) content = color_picker_asset_content() a1._standardize(content) a1._strip_empty_rows(content) a1._assign_kuids(content) form_title = a1.pop_setting(content, 'form_title') a1._autoname(content) assert 'schema' in content assert content['translations'] == [None] assert form_title == 'color picker' assert content['settings'] == {'id_string': 'colorpik'}
def _compile_asset_content(content): a1 = Asset(asset_type='survey', content={}) a1._standardize(content) a1._strip_empty_rows(content) a1._assign_kuids(content) form_title = a1.pop_setting(content, 'form_title', 'a backup title') a1._autoname(content) assert form_title == 'a backup title' # at this stage, the save is complete a1._expand_kobo_qs(content) a1._autoname(content) a1._assign_kuids(content) return content
def _compile_asset_content(content): a1 = Asset(asset_type='survey', content={}) a1._standardize(content) a1._strip_empty_rows(content) a1._assign_kuids(content) form_title = a1.pop_setting(content, 'form_title', 'a backup title') a1._autoname(content) assert form_title == 'a backup title' # at this stage, the save is complete a1._expand_kobo_qs(content) a1._autoname(content) a1._assign_kuids(content) return content
def test_autoname_handles_non_latin_labels_with_kobo_score_and_kobo_rank(): a = Asset(asset_type='survey', content={}) content = { 'survey': [ { 'type': 'score__row', 'label': ['नमस्ते'] }, { 'type': 'rank__level', 'label': ['नमस्ते'] }, ] } a._standardize(content) a._strip_empty_rows(content) a._assign_kuids(content) a._autoname(content) for row in content['survey']: assert row['$autoname'].startswith('select_one')