@@ 101-130 (lines=30) @@ | ||
98 | client.logout() |
|
99 | ||
100 | ||
101 | def test_workshop_pages(client, settings): |
|
102 | settings.SITE_VARIABLES['site_name'] = 'My Test Website' |
|
103 | f.create_usertype(slug='tutor', display_name='tutor') |
|
104 | poc_user = f.UserFactory(is_staff=False) |
|
105 | poc_type = f.create_usertype(slug='poc', display_name='poc') |
|
106 | poc_user.profile.usertype.clear() |
|
107 | poc_user.profile.usertype.add(poc_type) |
|
108 | org = f.create_organisation() |
|
109 | org.user.add(poc_user) |
|
110 | org.save() |
|
111 | poc_user.profile.location = org.location |
|
112 | poc_user.profile.save() |
|
113 | workshop = f.create_workshop(requester=org) |
|
114 | workshop.presenter.add(poc_user) |
|
115 | workshop.save() |
|
116 | ||
117 | url_list = [ |
|
118 | '/workshop/', |
|
119 | '/workshop/create/', |
|
120 | '/workshop/{}/'.format(workshop.id), |
|
121 | ] |
|
122 | ||
123 | for page_url in url_list: |
|
124 | client.login(poc_user) |
|
125 | response = client.get(page_url) |
|
126 | assert response.status_code == 200, 'Failed for %s' % page_url |
|
127 | assert poc_user.get_full_name() in str(response.content) |
|
128 | assert settings.SITE_VARIABLES[ |
|
129 | 'site_name'] in str(response.content) |
|
130 | client.logout() |
|
131 | ||
@@ 70-98 (lines=29) @@ | ||
67 | client.logout() |
|
68 | ||
69 | ||
70 | def test_orgnisation_pages(client, settings): |
|
71 | f.create_usertype(slug='tutor', display_name='tutor') |
|
72 | settings.SITE_VARIABLES['site_name'] = 'My Test Website' |
|
73 | normal_user = f.UserFactory(is_staff=False) |
|
74 | ||
75 | poc_type = f.create_usertype(slug='poc', display_name='poc') |
|
76 | normal_user.profile.usertype.clear() |
|
77 | normal_user.profile.usertype.add(poc_type) |
|
78 | org = f.create_organisation() |
|
79 | org.user.add(normal_user) |
|
80 | org.save() |
|
81 | normal_user.profile.location = org.location |
|
82 | normal_user.profile.save() |
|
83 | ||
84 | url_list = [ |
|
85 | '/organisation/', |
|
86 | '/organisation/create/', |
|
87 | '/organisation/{}/'.format(org.id), |
|
88 | '/organisation/{}/edit/'.format(org.id), |
|
89 | ] |
|
90 | ||
91 | for page_url in url_list: |
|
92 | client.login(normal_user) |
|
93 | response = client.get(page_url) |
|
94 | assert response.status_code == 200, 'Failed for %s' % page_url |
|
95 | assert normal_user.get_full_name() in str(response.content) |
|
96 | assert settings.SITE_VARIABLES[ |
|
97 | 'site_name'] in str(response.content) |
|
98 | client.logout() |
|
99 | ||
100 | ||
101 | def test_workshop_pages(client, settings): |