50 |
50 |
clean_temporary_pub()
|
51 |
51 |
|
52 |
52 |
|
|
53 |
@pytest.fixture
|
|
54 |
def formdef(pub):
|
|
55 |
FormDef.wipe()
|
|
56 |
formdef = FormDef()
|
|
57 |
formdef.name = 'form title'
|
|
58 |
formdef.fields = []
|
|
59 |
formdef.store()
|
|
60 |
return formdef
|
|
61 |
|
|
62 |
|
53 |
63 |
def test_forms(pub):
|
54 |
64 |
create_superuser(pub)
|
55 |
65 |
pub.role_class.wipe()
|
... | ... | |
114 |
124 |
assert '</li>' not in option_line
|
115 |
125 |
|
116 |
126 |
|
117 |
|
def test_forms_edit(pub):
|
|
127 |
def test_forms_edit_confirmation_page(pub, formdef):
|
118 |
128 |
create_superuser(pub)
|
119 |
129 |
create_role(pub)
|
120 |
130 |
|
121 |
|
FormDef.wipe()
|
122 |
|
formdef = FormDef()
|
123 |
|
formdef.name = 'form title'
|
124 |
|
formdef.fields = []
|
125 |
|
formdef.store()
|
126 |
|
|
127 |
131 |
app = login(get_app(pub))
|
128 |
132 |
resp = app.get('/backoffice/forms/1/')
|
129 |
133 |
|
130 |
|
# try changing an option
|
131 |
|
|
132 |
134 |
# confirmation page
|
133 |
135 |
assert_option_display(resp, 'Confirmation Page', 'Enabled')
|
134 |
136 |
resp = resp.click('Confirmation Page')
|
... | ... | |
150 |
152 |
assert_option_display(resp, 'Confirmation Page', 'Disabled')
|
151 |
153 |
assert FormDef.get(1).confirmation is False
|
152 |
154 |
|
|
155 |
|
|
156 |
def test_forms_edit_limit_one_form(pub, formdef):
|
|
157 |
create_superuser(pub)
|
|
158 |
create_role(pub)
|
|
159 |
|
|
160 |
app = login(get_app(pub))
|
|
161 |
resp = app.get('/backoffice/forms/1/')
|
|
162 |
|
153 |
163 |
# Limit to one form
|
154 |
164 |
assert_option_display(resp, 'Limit to one form', 'Disabled')
|
155 |
165 |
resp = resp.click('Limit to one form')
|
... | ... | |
161 |
171 |
assert_option_display(resp, 'Limit to one form', 'Enabled')
|
162 |
172 |
assert FormDef.get(1).only_allow_one is True
|
163 |
173 |
|
|
174 |
|
|
175 |
def test_forms_edit_management(pub, formdef):
|
|
176 |
create_superuser(pub)
|
|
177 |
create_role(pub)
|
|
178 |
|
|
179 |
app = login(get_app(pub))
|
|
180 |
resp = app.get('/backoffice/forms/1/')
|
|
181 |
|
164 |
182 |
# Misc management
|
165 |
183 |
assert_option_display(resp, 'Management', 'Default')
|
166 |
184 |
resp = resp.click('Management', href='options/management')
|
... | ... | |
172 |
190 |
assert_option_display(resp, 'Management', 'Custom')
|
173 |
191 |
assert FormDef.get(1).include_download_all_button is True
|
174 |
192 |
|
|
193 |
|
|
194 |
def test_forms_edit_tracking_code(pub, formdef):
|
|
195 |
create_superuser(pub)
|
|
196 |
create_role(pub)
|
|
197 |
|
|
198 |
app = login(get_app(pub))
|
|
199 |
resp = app.get('/backoffice/forms/1/')
|
|
200 |
|
175 |
201 |
# Tracking code
|
176 |
202 |
assert_option_display(resp, 'Tracking Code', 'Disabled')
|
177 |
203 |
resp = resp.click('Tracking Code')
|
... | ... | |
195 |
221 |
resp = resp.forms[0].submit().follow()
|
196 |
222 |
assert FormDef.get(1).drafts_lifespan == '5'
|
197 |
223 |
|
|
224 |
|
|
225 |
def test_forms_edit_captcha(pub, formdef):
|
|
226 |
create_superuser(pub)
|
|
227 |
create_role(pub)
|
|
228 |
|
|
229 |
app = login(get_app(pub))
|
|
230 |
resp = app.get('/backoffice/forms/1/')
|
|
231 |
|
198 |
232 |
# CAPTCHA
|
199 |
233 |
assert_option_display(resp, 'CAPTCHA for anonymous users', 'Disabled')
|
200 |
234 |
resp = resp.click('CAPTCHA for anonymous users')
|
... | ... | |
206 |
240 |
assert_option_display(resp, 'CAPTCHA for anonymous users', 'Enabled')
|
207 |
241 |
assert FormDef.get(1).has_captcha is True
|
208 |
242 |
|
|
243 |
|
|
244 |
def test_forms_edit_appearance(pub, formdef):
|
|
245 |
create_superuser(pub)
|
|
246 |
create_role(pub)
|
|
247 |
|
|
248 |
app = login(get_app(pub))
|
|
249 |
resp = app.get('/backoffice/forms/1/')
|
|
250 |
|
209 |
251 |
# Appearance
|
210 |
252 |
assert_option_display(resp, 'Appearance', 'Standard')
|
211 |
253 |
resp = resp.click('Appearance')
|
... | ... | |
217 |
259 |
assert_option_display(resp, 'Appearance', 'foobar')
|
218 |
260 |
assert FormDef.get(1).appearance_keywords == 'foobar'
|
219 |
261 |
|
|
262 |
|
|
263 |
def test_forms_edit_publication(pub, formdef):
|
|
264 |
create_superuser(pub)
|
|
265 |
create_role(pub)
|
|
266 |
|
|
267 |
app = login(get_app(pub))
|
|
268 |
resp = app.get('/backoffice/forms/1/')
|
|
269 |
|
220 |
270 |
# Publication
|
221 |
271 |
assert_option_display(resp, 'Online Status', 'Active')
|
222 |
272 |
resp = resp.click('Online Status')
|
... | ... | |
246 |
296 |
resp = resp.follow()
|
247 |
297 |
assert_option_display(resp, 'Online Status', 'Inactive by date')
|
248 |
298 |
|
|
299 |
|
|
300 |
def test_forms_edit_geolocation(pub, formdef):
|
|
301 |
create_superuser(pub)
|
|
302 |
create_role(pub)
|
|
303 |
|
|
304 |
app = login(get_app(pub))
|
|
305 |
resp = app.get('/backoffice/forms/1/')
|
|
306 |
|
249 |
307 |
# enable geolocation
|
250 |
308 |
resp = resp.click('Geolocation')
|
251 |
309 |
resp.forms[0]['geoloc_label'] = 'Foobar'
|
252 |
|
-
|