-
Notifications
You must be signed in to change notification settings - Fork 75
Expand file tree
/
Copy pathtest_create_workshop.py
More file actions
51 lines (44 loc) · 1.6 KB
/
test_create_workshop.py
File metadata and controls
51 lines (44 loc) · 1.6 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
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 + '/accounts/login/'
base.login_and_confirm(browser, url, outbox, user, password)
user.save()
location = f.create_locaiton(name='location1')
user.profile.location = location
user.profile.usertype.clear()
user.profile.usertype.add(poc_type)
user.profile.interested_states.add(state)
user.profile.save()
url = base_url + '/accounts/login/'
base.login(browser, url, user, password)
# validate if user belongs to organisation
url = base_url + '/workshop/create/'
browser.visit(url)
assert browser.is_text_present("create organisaiton.")
# Create org
org = f.create_organisation(location=location)
org.user.add(user)
user.profile.interested_locations.add(org.location)
# user.profile.location = org.location
# user.profile.save()
org.save()
section1 = f.create_workshop_section(name='section1')
# invalid form
url = base_url + '/workshop/create/'
browser.visit(url)
browser.fill('no_of_participants', 10)
browser.fill('expected_date', '11/12/2018')
browser.find_by_css('[type=submit]')[0].click()
assert browser.is_text_present('This field is required.')
# valid form
url = base_url + '/workshop/create/'
base.workshop_create(browser, url, org, section1)