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_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 volunteer_for_duty(volunteer_name, campaign_name, duty_name):
    volunteer = the('Volunteer', name=volunteer_name)
    campaign = the('Campaign', name=campaign_name)
    duty = the('Duty', name=duty_name)
    visit("/volunteering/%s/%s/%s/" % (volunteer.slug, campaign.slug,
                                       duty.slug))
    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_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_attribute(attribute_name):
    visit('/admin/volunteering/attribute/')
    click('Add')
    form()['name'] = attribute_name
    submit()
def and_submits_the_form(step):
    submit()