# Path: tests/base.py
# def create_user(password):
# def login(browser, url, user, password):
# def login_and_confirm(browser, url, outbox, user, password):
# def workshop_create(browser, url, org, section):
# def profile_poc_create(
#         browser, url, usertype_id,
#         section_id, state_id, location_id):
# def profile_tutor_create(
#         browser, url, usertype_id,
#         section_id, state_id, location_id):
# 
# Path: tests/factories.py
# class Factory(factory.DjangoModelFactory):
#     class Meta:
# class UserTypeFactory(Factory):
#     class Meta:
# class UserFactory(Factory):
#     class Meta:
# class StateFactory(Factory):
#     class Meta:
# class LocationFactory(Factory):
#     class Meta:
# class OrganisationFactory(Factory):
#     class Meta:
# class RegionalLeadFactory(Factory):
#     class Meta:
# class WorkshopSectionFactory(Factory):
#     class Meta:
# class WorkshopFactory(Factory):
#     class Meta:
# class WorkshopRatingValuesFactory(Factory):
#     class Meta:
# def create_usertype(**kwargs):
# def create_user(**kwargs):
# def create_organisation(**kwargs):
# def create_regional_lead(**kwargs):
# def create_workshop(**kwargs):
# def create_workshop_rating(**kwargs):
# def create_workshop_section(**kwargs):
# def create_locaiton(**kwargs):
# def create_state(**kwargs):


from tests import base
from tests import factories as f
outbox_len = 0
password = '123123'


def test_workshop_create(base_url, browser, outbox):
    """
    """
    f.create_usertype(slug='tutor', display_name='tutor')
    poc_type = f.create_usertype(slug='poc', display_name='poc')
    state = f.create_state()
    user = base.create_user(password)
    url = base_url + '/workshop/'
    base.login_and_confirm(browser, url, outbox, user, password)
    user.save()
    location = f.create_locaiton(name='location1')
    section1 = f.create_workshop_section(name='section1')

    user.profile.location = location
    user.profile.usertype.clear()
    user.profile.usertype.add(poc_type)
    user.profile.interested_states.add(state)
    user.profile.mobile = '1234567890'
    # browser.select('usertype', poc_type.id)
    user.profile.interested_sections.add(section1)
    user.profile.occupation = 'occupation'
    user.profile.work_location = 'work_location'

    user.profile.save()

    url = base_url + '/workshop/'

# Path: tests/base.py
# def create_user(password):
# def login(browser, url, user, password):
# def login_and_confirm(browser, url, outbox, user, password):
# def workshop_create(browser, url, org, section):
# def profile_poc_create(
#         browser, url, usertype_id,
#         section_id, state_id, location_id):
# def profile_tutor_create(
#         browser, url, usertype_id,
#         section_id, state_id, location_id):
# 
# Path: tests/factories.py
# class Factory(factory.DjangoModelFactory):
#     class Meta:
# class UserTypeFactory(Factory):
#     class Meta:
# class UserFactory(Factory):
#     class Meta:
# class StateFactory(Factory):
#     class Meta:
# class LocationFactory(Factory):
#     class Meta:
# class OrganisationFactory(Factory):
#     class Meta:
# class RegionalLeadFactory(Factory):
#     class Meta:
# class WorkshopSectionFactory(Factory):
#     class Meta:
# class WorkshopFactory(Factory):
#     class Meta:
# class WorkshopRatingValuesFactory(Factory):
#     class Meta:
# def create_usertype(**kwargs):
# def create_user(**kwargs):
# def create_organisation(**kwargs):
# def create_regional_lead(**kwargs):
# def create_workshop(**kwargs):
# def create_workshop_rating(**kwargs):
# def create_workshop_section(**kwargs):
# def create_locaiton(**kwargs):
# def create_state(**kwargs):


# Path: tests/functional/workshop/test_create_workshop.py
from tests import base
from tests import factories as f

outbox_len = 0
password = '123123'


def test_workshop_create(base_url, browser, outbox):
    """
    """
    f.create_usertype(slug='tutor', display_name='tutor')
    poc_type = f.create_usertype(slug='poc', display_name='poc')
    state = f.create_state()
    user = base.create_user(password)
    url = base_url + '/workshop/'
    base.login_and_confirm(browser, url, outbox, user, password)
    user.save()
    location = f.create_locaiton(name='location1')
    section1 = f.create_workshop_section(name='section1')

    user.profile.location = location
    user.profile.usertype.clear()
    user.profile.usertype.add(poc_type)
    user.profile.interested_states.add(state)
    user.profile.mobile = '1234567890'
    # browser.select('usertype', poc_type.id)
    user.profile.interested_sections.add(section1)
    user.profile.occupation = 'occupation'
    user.profile.work_location = 'work_location'

    user.profile.save()

    url = base_url + '/workshop/'

    base.login(browser, url, user, password)