def create_volunteer(volunteer_name, attribute_names=[]): visit('/admin/volunteering/volunteer/') click('Add') form()['name'] = volunteer_name for attribute_name in attribute_names: form().select_multiple('attributes', texts=attribute_names) submit()
def create_campaign(campaign_name, duties=[]): show_browser(True) # for test coverage report visit('/admin/volunteering/campaign/') click(description='Add') form()['name'] = campaign_name form()['slug'] = slugify(campaign_name) submit() for duty in duties: duty_name = duty['Name'] create_duty(duty_name, duty['Attributes']) create_campaign_duty(campaign_name, duty_name)
def create_campaign_duty(campaign_name, duty_name): visit('/admin/volunteering/campaignduty/') click('Add') f = form() f.select('campaign', text=campaign_name) f.select('duty', text=duty_name) submit()
def create_duties(duty_name, attribute_names=[]): visit('/admin/volunteering/duty/') click('Add') f = form() # f['name'] = duty_name # f['slug'] = slugify(duty_name) for attribute_name in attribute_names: f.select_multiple('attributes', texts=attribute_names) submit()
def create_attribute(attribute_name): visit('/admin/volunteering/attribute/') click('Add') form()['name'] = attribute_name submit()
def set_multi_select_field_on_admin_page(field, value): form().select_multiple(field, texts=[value])
def set_select_field_on_admin_page(field, value): form().select(field, text=value)
def set_field_on_admin_page(field, value): form()[field] = value