0005-misc-pylint-fix-unused-variable-52630.patch
tests/api/test_carddef.py | ||
---|---|---|
209 | 209 |
assert resp.json['err'] == 0 |
210 | 210 |
assert 'job' in resp.json['data'] |
211 | 211 |
job_id = resp.json['data']['job']['id'] |
212 |
job = AfterJob.get(job_id) |
|
213 | 212 |
assert AfterJob.get(job_id).status == 'completed' |
214 | 213 |
# get job status from its api url |
215 | 214 |
resp = get_app(pub).get(sign_uri(resp.json['data']['job']['url'], user=local_user)) |
tests/api/test_formdata.py | ||
---|---|---|
1050 | 1050 |
data_class = formdef.data_class() |
1051 | 1051 |
data_class.wipe() |
1052 | 1052 | |
1053 |
for i in range(10):
|
|
1053 |
for _ in range(10):
|
|
1054 | 1054 |
formdata = data_class() |
1055 | 1055 |
formdata.data = {'0': 'FOO BAR'} |
1056 | 1056 |
formdata.user_id = local_user.id |
... | ... | |
1099 | 1099 |
data_class = formdef.data_class() |
1100 | 1100 |
data_class.wipe() |
1101 | 1101 | |
1102 |
for i in range(10):
|
|
1102 |
for _ in range(10):
|
|
1103 | 1103 |
formdata = data_class() |
1104 | 1104 |
formdata.data = {'0': 'FOO BAR'} |
1105 | 1105 |
formdata.user_id = local_user.id |
tests/backoffice_pages/test_all.py | ||
---|---|---|
816 | 816 |
resp_csv = resp.click('Export as CSV File') |
817 | 817 |
assert resp_csv.text.splitlines()[1].endswith(',plop,2020-04-24,Yes,aa') |
818 | 818 | |
819 |
resp_ods = resp.click('Export a Spreadsheet') |
|
820 | ||
821 | 819 |
resp_map = resp.click('Plot on a Map') |
822 | 820 |
geojson_url = re.findall(r'data-geojson-url="(.*?)"', resp_map.text)[0] |
823 | 821 |
resp_geojson = app.get(geojson_url) |
... | ... | |
1745 | 1743 |
resp = resp.follow() |
1746 | 1744 |
assert 'Executing task "Show user" on forms' in resp.text |
1747 | 1745 |
assert '>completed<' in resp.text |
1748 |
for i, id in enumerate(sorted(ids, key=lambda x: int(x))):
|
|
1746 |
for id in sorted(ids, key=lambda x: int(x)):
|
|
1749 | 1747 |
content = formdef.data_class().get(id).evolution[-1].parts[0].content |
1750 | 1748 |
assert 'session_user=admin' in content |
1751 | 1749 | |
... | ... | |
1856 | 1854 | |
1857 | 1855 | |
1858 | 1856 |
def test_backoffice_map(pub): |
1859 |
user = create_user(pub)
|
|
1857 |
create_user(pub) |
|
1860 | 1858 |
create_environment(pub) |
1861 | 1859 |
form_class = FormDef.get_by_urlname('form-title').data_class() |
1862 | 1860 |
number31 = [x for x in form_class.select() if x.data['1'] == 'FOO BAR 30'][0] |
... | ... | |
1893 | 1891 | |
1894 | 1892 | |
1895 | 1893 |
def test_backoffice_geojson(pub): |
1896 |
user = create_user(pub)
|
|
1894 |
create_user(pub) |
|
1897 | 1895 |
create_environment(pub) |
1898 | 1896 |
formdef = FormDef.get_by_urlname('form-title') |
1899 | 1897 |
formdef.fields.append(fields.MapField(id='4', label='4th field', type='map')) |
... | ... | |
2002 | 2000 |
workflow = Workflow.get_default_workflow() |
2003 | 2001 |
workflow.id = '2' |
2004 | 2002 |
action = workflow.add_global_action('FOOBAR') |
2005 |
remove = action.append_item('remove')
|
|
2003 |
action.append_item('remove') |
|
2006 | 2004 |
trigger = action.triggers[0] |
2007 | 2005 |
trigger.roles = [x.id for x in pub.role_class.select() if x.name == 'foobar'] |
2008 | 2006 | |
... | ... | |
2123 | 2121 | |
2124 | 2122 | |
2125 | 2123 |
def test_backoffice_geolocation_info(pub): |
2126 |
user = create_user(pub)
|
|
2124 |
create_user(pub) |
|
2127 | 2125 |
create_environment(pub) |
2128 | 2126 |
formdef = FormDef.get_by_urlname('form-title') |
2129 | 2127 |
formdef.geolocations = {'base': 'Geolocafoobar'} |
... | ... | |
3163 | 3161 |
pytest.skip('this requires SQL') |
3164 | 3162 |
return |
3165 | 3163 | |
3166 |
user = create_user(pub)
|
|
3164 |
create_user(pub) |
|
3167 | 3165 |
create_environment(pub) |
3168 | 3166 | |
3169 | 3167 |
app = login(get_app(pub)) |
... | ... | |
3203 | 3201 |
pytest.skip('this requires SQL') |
3204 | 3202 |
return |
3205 | 3203 | |
3206 |
user = create_user(pub)
|
|
3204 |
create_user(pub) |
|
3207 | 3205 |
create_environment(pub) |
3208 | 3206 | |
3209 | 3207 |
app = login(get_app(pub)) |
... | ... | |
3579 | 3577 | |
3580 | 3578 | |
3581 | 3579 |
def test_menu_json(pub): |
3582 |
user = create_user(pub)
|
|
3580 |
create_user(pub) |
|
3583 | 3581 |
create_environment(pub) |
3584 | 3582 |
resp = login(get_app(pub)).get('/backoffice/menu.json') |
3585 | 3583 |
menu_json_str = resp.text |
... | ... | |
3700 | 3698 | |
3701 | 3699 | |
3702 | 3700 |
def test_backoffice_resume_folded(pub): |
3703 |
user = create_user(pub)
|
|
3701 |
create_user(pub) |
|
3704 | 3702 |
create_environment(pub) |
3705 | 3703 |
form_class = FormDef.get_by_urlname('form-title').data_class() |
3706 | 3704 |
number31 = [x for x in form_class.select() if x.data['1'] == 'FOO BAR 30'][0] |
... | ... | |
4236 | 4234 |
if not pub.is_using_postgresql(): |
4237 | 4235 |
pytest.skip('this requires SQL') |
4238 | 4236 |
return |
4239 |
user = create_user(pub)
|
|
4237 |
create_user(pub) |
|
4240 | 4238 |
create_environment(pub) |
4241 | 4239 | |
4242 | 4240 |
wf = Workflow.get_default_workflow() |
... | ... | |
4283 | 4281 |
pytest.skip('this requires SQL') |
4284 | 4282 |
return |
4285 | 4283 | |
4286 |
user = create_user(pub)
|
|
4284 |
create_user(pub) |
|
4287 | 4285 |
create_environment(pub) |
4288 | 4286 | |
4289 | 4287 |
wf = Workflow.get_default_workflow() |
... | ... | |
4326 | 4324 | |
4327 | 4325 | |
4328 | 4326 |
def test_backoffice_criticality_formdata_view(pub): |
4329 |
user = create_user(pub)
|
|
4327 |
create_user(pub) |
|
4330 | 4328 |
create_environment(pub) |
4331 | 4329 | |
4332 | 4330 |
wf = Workflow.get_default_workflow() |
... | ... | |
4958 | 4956 | |
4959 | 4957 | |
4960 | 4958 |
def test_workflow_jump_previous_on_submit(pub): |
4961 |
user = create_user(pub)
|
|
4959 |
create_user(pub) |
|
4962 | 4960 |
create_environment(pub) |
4963 | 4961 | |
4964 | 4962 |
wf = Workflow(name='blah') |
... | ... | |
5091 | 5089 | |
5092 | 5090 | |
5093 | 5091 |
def test_backoffice_fields(pub): |
5094 |
user = create_user(pub)
|
|
5092 |
create_user(pub) |
|
5095 | 5093 |
create_environment(pub) |
5096 | 5094 | |
5097 | 5095 |
wf = Workflow(name='bo fields') |
... | ... | |
5101 | 5099 |
id='bo1', label='1st backoffice field', type='string', varname='backoffice_blah', required=False |
5102 | 5100 |
), |
5103 | 5101 |
] |
5104 |
st1 = wf.add_status('Status1')
|
|
5102 |
wf.add_status('Status1') |
|
5105 | 5103 |
wf.store() |
5106 | 5104 | |
5107 | 5105 |
formdef = FormDef.get_by_urlname('form-title') |
... | ... | |
5584 | 5582 | |
5585 | 5583 | |
5586 | 5584 |
def test_workflow_comment_required(pub): |
5587 |
user = create_user(pub)
|
|
5585 |
create_user(pub) |
|
5588 | 5586 |
create_environment(pub) |
5589 | 5587 | |
5590 | 5588 |
wf = Workflow(name='blah') |
tests/form_pages/test_all.py | ||
---|---|---|
168 | 168 |
formdef.enable_tracking_codes = True |
169 | 169 |
formdef.category_id = '1' |
170 | 170 |
wf = Workflow(name='status') |
171 |
st1 = wf.add_status('Status1', 'st1')
|
|
171 |
wf.add_status('Status1', 'st1') |
|
172 | 172 |
wf.store() |
173 | 173 |
formdef.workflow_id = wf.id |
174 | 174 |
formdef.store() |
... | ... | |
276 | 276 |
assert not '<a href="test/">test</a>' in home.text |
277 | 277 | |
278 | 278 |
# check access is denied |
279 |
resp = get_app(pub).get('/test/', status=403)
|
|
279 |
get_app(pub).get('/test/', status=403) |
|
280 | 280 | |
281 | 281 | |
282 | 282 |
def test_home_disabled_with_redirect(pub): |
... | ... | |
411 | 411 | |
412 | 412 | |
413 | 413 |
def test_form_access_auth_context(pub): |
414 |
user = create_user(pub)
|
|
414 |
create_user(pub) |
|
415 | 415 | |
416 | 416 |
pub.load_site_options() |
417 | 417 |
if not pub.site_options.has_section('options'): |
... | ... | |
1101 | 1101 |
formdef.data_class().wipe() |
1102 | 1102 | |
1103 | 1103 |
with mock.patch('wcs.qommon.publisher.Substitutions.invalidate_cache') as invalidate_cache: |
1104 |
resp = get_app(pub).get('/test/')
|
|
1104 |
get_app(pub).get('/test/') |
|
1105 | 1105 |
call_count = invalidate_cache.call_count |
1106 | 1106 | |
1107 | 1107 |
for i in range(30): |
... | ... | |
1117 | 1117 | |
1118 | 1118 |
# check the cache doesn't get invalidated for every page |
1119 | 1119 |
with mock.patch('wcs.qommon.publisher.Substitutions.invalidate_cache') as invalidate_cache: |
1120 |
resp = get_app(pub).get('/test/')
|
|
1120 |
get_app(pub).get('/test/') |
|
1121 | 1121 |
assert invalidate_cache.call_count <= call_count |
1122 | 1122 | |
1123 | 1123 | |
... | ... | |
1446 | 1446 | |
1447 | 1447 | |
1448 | 1448 |
def test_form_summary_empty_pages(pub): |
1449 |
user = create_user(pub)
|
|
1449 |
create_user(pub) |
|
1450 | 1450 |
formdef = create_formdef() |
1451 | 1451 |
formdef.fields = [ |
1452 | 1452 |
fields.PageField(id='0', label='1st page', type='page'), |
... | ... | |
1574 | 1574 |
def test_form_visit_existing(pub): |
1575 | 1575 |
user = create_user(pub) |
1576 | 1576 |
formdef = create_formdef() |
1577 |
page = login(get_app(pub), username='foo', password='foo').get('/test/')
|
|
1577 |
login(get_app(pub), username='foo', password='foo').get('/test/') |
|
1578 | 1578 |
formdef.data_class().wipe() |
1579 | 1579 | |
1580 | 1580 |
formdata = formdef.data_class()() |
... | ... | |
1720 | 1720 |
assert resp.location.startswith('http://example.net/login') |
1721 | 1721 | |
1722 | 1722 |
# or logged users that didn't enter the code: |
1723 |
user = create_user(pub)
|
|
1723 |
create_user(pub) |
|
1724 | 1724 |
login(get_app(pub), username='foo', password='foo').get( |
1725 | 1725 |
'http://example.net/test/%s/' % formdata_id, status=403 |
1726 | 1726 |
) |
... | ... | |
2076 | 2076 | |
2077 | 2077 | |
2078 | 2078 |
def test_form_discard_draft(pub, nocache): |
2079 |
user = create_user(pub)
|
|
2079 |
create_user(pub) |
|
2080 | 2080 | |
2081 | 2081 |
formdef = create_formdef() |
2082 | 2082 |
formdef.fields = [fields.StringField(id='0', label='string')] |
... | ... | |
2247 | 2247 | |
2248 | 2248 | |
2249 | 2249 |
def test_form_draft_with_file(pub): |
2250 |
user = create_user(pub)
|
|
2250 |
create_user(pub) |
|
2251 | 2251 |
formdef = create_formdef() |
2252 | 2252 |
formdef.fields = [fields.FileField(id='0', label='file', type='file')] |
2253 | 2253 |
formdef.enable_tracking_codes = True |
... | ... | |
2284 | 2284 | |
2285 | 2285 | |
2286 | 2286 |
def test_form_draft_with_file_direct_validation(pub): |
2287 |
user = create_user(pub)
|
|
2287 |
create_user(pub) |
|
2288 | 2288 |
formdef = create_formdef() |
2289 | 2289 |
formdef.fields = [fields.FileField(id='0', label='file', type='file')] |
2290 | 2290 |
formdef.enable_tracking_codes = True |
... | ... | |
2309 | 2309 | |
2310 | 2310 | |
2311 | 2311 |
def test_form_draft_with_date(pub): |
2312 |
user = create_user(pub)
|
|
2312 |
create_user(pub) |
|
2313 | 2313 |
formdef = create_formdef() |
2314 | 2314 |
formdef.fields = [fields.DateField(id='0', label='date', type='date')] |
2315 | 2315 |
formdef.enable_tracking_codes = True |
... | ... | |
2343 | 2343 |
formdef.data_class().wipe() |
2344 | 2344 | |
2345 | 2345 |
# no draft |
2346 |
resp = get_app(pub).get('/test/')
|
|
2346 |
get_app(pub).get('/test/') |
|
2347 | 2347 |
assert formdef.data_class().count() == 0 |
2348 | 2348 |
formdef.data_class().wipe() |
2349 | 2349 | |
2350 | 2350 |
# draft created if there's been some prefilled fields |
2351 | 2351 |
formdef.fields[0].prefill = {'type': 'string', 'value': '{{request.GET.test|default:""}}'} |
2352 | 2352 |
formdef.store() |
2353 |
resp = get_app(pub).get('/test/?test=hello')
|
|
2353 |
get_app(pub).get('/test/?test=hello') |
|
2354 | 2354 |
assert formdef.data_class().count() == 1 |
2355 | 2355 |
formdef.data_class().wipe() |
2356 | 2356 | |
2357 | 2357 |
# unless the call was made from an application |
2358 |
resp = get_app(pub).get('/test/?test=hello', headers={'User-agent': 'python-requests/0'})
|
|
2358 |
get_app(pub).get('/test/?test=hello', headers={'User-agent': 'python-requests/0'}) |
|
2359 | 2359 |
assert formdef.data_class().count() == 0 |
2360 | 2360 | |
2361 | 2361 |
# or a bot |
2362 |
resp = get_app(pub).get('/test/?test=hello', headers={'User-agent': 'Googlebot'})
|
|
2362 |
get_app(pub).get('/test/?test=hello', headers={'User-agent': 'Googlebot'}) |
|
2363 | 2363 |
assert formdef.data_class().count() == 0 |
2364 | 2364 | |
2365 | 2365 | |
... | ... | |
2422 | 2422 | |
2423 | 2423 | |
2424 | 2424 |
def test_form_password_field_submit(pub): |
2425 |
user = create_user(pub)
|
|
2425 |
create_user(pub) |
|
2426 | 2426 |
form_password_field_submit(get_app(pub), 'foobar') |
2427 | 2427 |
form_password_field_submit(get_app(pub), force_str(u'• 83003706')) |
2428 | 2428 |
form_password_field_submit(login(get_app(pub), username='foo', password='foo'), 'foobar\u00eb') |
... | ... | |
2461 | 2461 | |
2462 | 2462 | |
2463 | 2463 |
def test_form_multi_page_post_edit(pub): |
2464 |
user = create_user(pub)
|
|
2464 |
create_user(pub) |
|
2465 | 2465 | |
2466 | 2466 |
formdef = create_formdef() |
2467 | 2467 |
formdef.fields = [ |
... | ... | |
2591 | 2591 | |
2592 | 2592 | |
2593 | 2593 |
def test_form_edit_autocomplete_list(pub): |
2594 |
user = create_user(pub)
|
|
2594 |
create_user(pub) |
|
2595 | 2595 | |
2596 | 2596 |
NamedDataSource.wipe() |
2597 | 2597 |
data_source = NamedDataSource(name='foobar') |
... | ... | |
2668 | 2668 | |
2669 | 2669 | |
2670 | 2670 |
def test_form_count_dispatching(pub): |
2671 |
user = create_user(pub)
|
|
2671 |
create_user(pub) |
|
2672 | 2672 | |
2673 | 2673 |
formdef = create_formdef() |
2674 | 2674 |
formdef.fields = [] |
... | ... | |
2681 | 2681 |
jump.status = 'st2' |
2682 | 2682 |
st1.items.append(jump) |
2683 | 2683 |
jump.parent = st1 |
2684 |
st2 = workflow.add_status('Status2', 'st2')
|
|
2684 |
workflow.add_status('Status2', 'st2') |
|
2685 | 2685 |
workflow.store() |
2686 | 2686 | |
2687 | 2687 |
formdef.workflow_id = workflow.id |
... | ... | |
2844 | 2844 | |
2845 | 2845 | |
2846 | 2846 |
def test_form_page_string_prefill(pub): |
2847 |
user = create_user(pub)
|
|
2847 |
create_user(pub) |
|
2848 | 2848 |
formdef = create_formdef() |
2849 | 2849 |
formdef.data_class().wipe() |
2850 | 2850 |
formdef.fields = [ |
... | ... | |
2858 | 2858 | |
2859 | 2859 | |
2860 | 2860 |
def test_form_page_profile_prefill(pub): |
2861 |
user = create_user(pub)
|
|
2861 |
create_user(pub) |
|
2862 | 2862 |
formdef = create_formdef() |
2863 | 2863 |
formdef.data_class().wipe() |
2864 | 2864 |
formdef.fields = [fields.StringField(id='0', label='string', prefill={'type': 'user', 'value': 'email'})] |
... | ... | |
2912 | 2912 | |
2913 | 2913 | |
2914 | 2914 |
def test_form_page_formula_prefill(pub): |
2915 |
user = create_user(pub)
|
|
2915 |
create_user(pub) |
|
2916 | 2916 |
formdef = create_formdef() |
2917 | 2917 |
formdef.data_class().wipe() |
2918 | 2918 |
formdef.fields = [ |
... | ... | |
2926 | 2926 | |
2927 | 2927 | |
2928 | 2928 |
def test_form_page_template_prefill(pub): |
2929 |
user = create_user(pub)
|
|
2929 |
create_user(pub) |
|
2930 | 2930 |
formdef = create_formdef() |
2931 | 2931 |
formdef.data_class().wipe() |
2932 | 2932 |
formdef.fields = [ |
... | ... | |
2958 | 2958 | |
2959 | 2959 | |
2960 | 2960 |
def test_form_page_session_var_prefill(pub): |
2961 |
user = create_user(pub)
|
|
2961 |
create_user(pub) |
|
2962 | 2962 |
formdef = create_formdef() |
2963 | 2963 |
formdef.data_class().wipe() |
2964 | 2964 |
formdef.fields = [ |
... | ... | |
3054 | 3054 | |
3055 | 3055 | |
3056 | 3056 |
def test_form_page_query_string_list_prefill(pub): |
3057 |
user = create_user(pub)
|
|
3057 |
create_user(pub) |
|
3058 | 3058 |
formdef = create_formdef() |
3059 | 3059 |
formdef.data_class().wipe() |
3060 | 3060 |
formdef.fields = [ |
... | ... | |
3095 | 3095 | |
3096 | 3096 | |
3097 | 3097 |
def test_form_page_profile_prefill_list(pub): |
3098 |
user = create_user(pub)
|
|
3098 |
create_user(pub) |
|
3099 | 3099 |
formdef = create_formdef() |
3100 | 3100 |
formdef.data_class().wipe() |
3101 | 3101 |
formdef.fields = [ |
... | ... | |
3134 | 3134 | |
3135 | 3135 | |
3136 | 3136 |
def test_form_page_formula_prefill_items_field(pub): |
3137 |
user = create_user(pub)
|
|
3137 |
create_user(pub) |
|
3138 | 3138 |
formdef = create_formdef() |
3139 | 3139 |
formdef.data_class().wipe() |
3140 | 3140 |
formdef.fields = [ |
... | ... | |
3282 | 3282 | |
3283 | 3283 | |
3284 | 3284 |
def test_form_captcha(pub): |
3285 |
user = create_user(pub)
|
|
3285 |
create_user(pub) |
|
3286 | 3286 |
formdef = create_formdef() |
3287 | 3287 |
formdef.data_class().wipe() |
3288 | 3288 |
formdef.fields = [fields.StringField(id='0', label='Some field')] |
... | ... | |
3323 | 3323 | |
3324 | 3324 | |
3325 | 3325 |
def test_form_captcha_and_no_validation_page(pub): |
3326 |
user = create_user(pub)
|
|
3326 |
create_user(pub) |
|
3327 | 3327 |
formdef = create_formdef() |
3328 | 3328 |
formdef.data_class().wipe() |
3329 | 3329 |
formdef.fields = [fields.StringField(id='0', label='Some field')] |
... | ... | |
3350 | 3350 | |
3351 | 3351 | |
3352 | 3352 |
def test_form_file_field_with_fargo(pub, fargo_url): |
3353 |
user = create_user(pub)
|
|
3353 |
create_user(pub) |
|
3354 | 3354 |
formdef = create_formdef() |
3355 | 3355 |
file_field = fields.FileField(id='0', label='file') |
3356 | 3356 |
assert file_field.allow_portfolio_picking is False |
... | ... | |
3398 | 3398 | |
3399 | 3399 | |
3400 | 3400 |
def test_form_file_field_without_fargo(pub): |
3401 |
user = create_user(pub)
|
|
3401 |
create_user(pub) |
|
3402 | 3402 |
formdef = create_formdef() |
3403 | 3403 |
file_field = fields.FileField(id='0', label='file') |
3404 | 3404 |
file_field.allow_portfolio_picking = True |
... | ... | |
3710 | 3710 |
assert formdef.data_class().select()[0].data == {'0': [['a', 'c', 'e'], ['b', 'd', '']]} |
3711 | 3711 | |
3712 | 3712 |
# check table is present in received email (via form_details). |
3713 |
user = create_user(pub)
|
|
3713 |
create_user(pub) |
|
3714 | 3714 |
resp = login(get_app(pub), username='foo', password='foo').get('/test/') |
3715 | 3715 |
resp.form['f0$c-0-0'] = 'àà' # would trigger column length bug (#23072) |
3716 | 3716 |
resp.form['f0$c-1-0'] = 'bb' |
... | ... | |
3784 | 3784 |
assert '37.00' in resp.text |
3785 | 3785 | |
3786 | 3786 |
# check table is present in received email (via form_details). |
3787 |
user = create_user(pub)
|
|
3787 |
create_user(pub) |
|
3788 | 3788 |
resp = login(get_app(pub), username='foo', password='foo').get('/test/') |
3789 | 3789 |
resp.form['f0$element0$col0'] = 'àà' |
3790 | 3790 |
resp.form['f0$element0$col1'] = '14' |
... | ... | |
3849 | 3849 |
formdef.store() |
3850 | 3850 |
formdef.data_class().wipe() |
3851 | 3851 | |
3852 |
resp = get_app(pub).get('/test/')
|
|
3852 |
get_app(pub).get('/test/') |
|
3853 | 3853 | |
3854 | 3854 | |
3855 | 3855 |
def test_form_table_rows_add_row(pub): |
... | ... | |
4074 | 4074 | |
4075 | 4075 | |
4076 | 4076 |
def test_form_page_formula_prefill_user_name(pub): |
4077 |
user = create_user(pub)
|
|
4077 |
create_user(pub) |
|
4078 | 4078 |
formdef = create_formdef() |
4079 | 4079 |
formdef.data_class().wipe() |
4080 | 4080 |
formdef.fields = [ |
... | ... | |
4090 | 4090 | |
4091 | 4091 | |
4092 | 4092 |
def test_form_page_formula_prefill_session_user(pub): |
4093 |
user = create_user(pub)
|
|
4093 |
create_user(pub) |
|
4094 | 4094 |
formdef = create_formdef() |
4095 | 4095 |
formdef.data_class().wipe() |
4096 | 4096 |
formdef.fields = [ |
... | ... | |
4428 | 4428 |
] |
4429 | 4429 |
formdef.store() |
4430 | 4430 |
orders = {} |
4431 |
for i in range(10):
|
|
4431 |
for _ in range(10):
|
|
4432 | 4432 |
resp = get_app(pub).get('/test/') |
4433 | 4433 |
orders['%s-%s-%s' % (resp.text.index('foo'), resp.text.index('bar'), resp.text.index('baz'))] = True |
4434 | 4434 |
assert len(orders.keys()) > 1 |
... | ... | |
4672 | 4672 |
st1.items.append(jump2) |
4673 | 4673 |
jump2.parent = st1 |
4674 | 4674 | |
4675 |
st2 = workflow.add_status('Status2', 'st2')
|
|
4676 |
st3 = workflow.add_status('Status3', 'st3')
|
|
4675 |
workflow.add_status('Status2', 'st2') |
|
4676 |
workflow.add_status('Status3', 'st3') |
|
4677 | 4677 |
workflow.store() |
4678 | 4678 | |
4679 | 4679 |
formdef.workflow_id = workflow.id |
... | ... | |
4686 | 4686 |
assert formdef.data_class().get(formdata.id).status == 'wf-st1' |
4687 | 4687 | |
4688 | 4688 |
app = get_app(pub) |
4689 |
resp = login(app, username='foo', password='foo').get('/')
|
|
4690 |
resp = app.post(formdata.get_url() + 'jump/trigger/XXX', status=403)
|
|
4689 |
login(app, username='foo', password='foo').get('/') |
|
4690 |
app.post(formdata.get_url() + 'jump/trigger/XXX', status=403) |
|
4691 | 4691 | |
4692 | 4692 |
pub.role_class.wipe() |
4693 | 4693 |
role = pub.role_class(name='xxx') |
... | ... | |
4695 | 4695 | |
4696 | 4696 |
jump.by = [role.id] |
4697 | 4697 |
workflow.store() |
4698 |
resp = app.post(formdata.get_url() + 'jump/trigger/XXX', status=403)
|
|
4698 |
app.post(formdata.get_url() + 'jump/trigger/XXX', status=403) |
|
4699 | 4699 | |
4700 | 4700 |
user.roles = [role.id] |
4701 | 4701 |
user.store() |
4702 |
resp = app.post(formdata.get_url() + 'jump/trigger/XXX', status=302)
|
|
4702 |
app.post(formdata.get_url() + 'jump/trigger/XXX', status=302) |
|
4703 | 4703 | |
4704 | 4704 |
formdata = formdef.data_class().get(formdata.id) |
4705 | 4705 |
assert formdata.status == 'wf-st2' |
4706 | 4706 | |
4707 | 4707 |
formdata.status = 'wf-st1' |
4708 | 4708 |
formdata.store() |
4709 |
resp = app.post(formdata.get_url() + 'jump/trigger/YYY', status=403)
|
|
4709 |
app.post(formdata.get_url() + 'jump/trigger/YYY', status=403) |
|
4710 | 4710 |
jump2.by = [role.id] |
4711 | 4711 |
workflow.store() |
4712 |
resp = app.post(formdata.get_url() + 'jump/trigger/YYY', status=302)
|
|
4712 |
app.post(formdata.get_url() + 'jump/trigger/YYY', status=302) |
|
4713 | 4713 |
formdata = formdef.data_class().get(formdata.id) |
4714 | 4714 |
assert formdata.status == 'wf-st3' |
4715 | 4715 |
assert formdata.workflow_data.get('_markers_stack') == [{'status_id': 'st1'}] |
4716 | 4716 | |
4717 | 4717 |
formdata.status = 'wf-st1' |
4718 | 4718 |
formdata.store() |
4719 |
resp = app.post(
|
|
4719 |
app.post( |
|
4720 | 4720 |
formdata.get_url() + 'jump/trigger/YYY', |
4721 | 4721 |
params=json.dumps({'data': {'foo': 'bar'}}), |
4722 | 4722 |
content_type='application/json', |
... | ... | |
4867 | 4867 | |
4868 | 4868 | |
4869 | 4869 |
def test_display_message(pub): |
4870 |
user = create_user(pub)
|
|
4870 |
create_user(pub) |
|
4871 | 4871 | |
4872 | 4872 |
formdef = create_formdef() |
4873 | 4873 |
formdef.fields = [] |
... | ... | |
4971 | 4971 | |
4972 | 4972 | |
4973 | 4973 |
def test_workflow_condition_on_message(pub): |
4974 |
user = create_user(pub)
|
|
4974 |
create_user(pub) |
|
4975 | 4975 | |
4976 | 4976 |
formdef = create_formdef() |
4977 | 4977 |
formdef.fields = [] |
... | ... | |
5011 | 5011 | |
5012 | 5012 | |
5013 | 5013 |
def test_session_cookie_flags(pub): |
5014 |
formdef = create_formdef()
|
|
5014 |
create_formdef() |
|
5015 | 5015 |
app = get_app(pub) |
5016 | 5016 |
resp = app.get('/test/', status=200) |
5017 | 5017 |
assert resp.headers['Set-Cookie'].startswith('sessionid-') |
... | ... | |
5214 | 5214 | |
5215 | 5215 | |
5216 | 5216 |
def test_item_field_from_cards(pub): |
5217 |
user = create_user(pub)
|
|
5217 |
create_user(pub) |
|
5218 | 5218 |
formdef = create_formdef() |
5219 | 5219 |
formdef.data_class().wipe() |
5220 | 5220 | |
... | ... | |
5526 | 5526 | |
5527 | 5527 | |
5528 | 5528 |
def test_item_field_with_disabled_items(http_requests, pub): |
5529 |
user = create_user(pub)
|
|
5529 |
create_user(pub) |
|
5530 | 5530 |
formdef = create_formdef() |
5531 | 5531 |
formdef.data_class().wipe() |
5532 | 5532 |
ds = {'type': 'json', 'value': 'http://remote.example.net/json'} |
... | ... | |
5634 | 5634 | |
5635 | 5635 | |
5636 | 5636 |
def test_items_field_with_disabled_items(http_requests, pub): |
5637 |
user = create_user(pub)
|
|
5637 |
create_user(pub) |
|
5638 | 5638 |
formdef = create_formdef() |
5639 | 5639 |
formdef.data_class().wipe() |
5640 | 5640 |
ds = {'type': 'json', 'value': 'http://remote.example.net/json'} |
... | ... | |
5689 | 5689 |
def test_item_field_autocomplete_json_source(http_requests, pub, error_email, emails): |
5690 | 5690 |
if pub.is_using_postgresql(): |
5691 | 5691 |
pub.loggederror_class.wipe() |
5692 |
user = create_user(pub)
|
|
5692 |
create_user(pub) |
|
5693 | 5693 |
formdef = create_formdef() |
5694 | 5694 |
formdef.data_class().wipe() |
5695 | 5695 | |
... | ... | |
5997 | 5997 | |
5998 | 5998 | |
5999 | 5999 |
def test_item_field_autocomplete_jsonp_source(http_requests, pub): |
6000 |
user = create_user(pub)
|
|
6000 |
create_user(pub) |
|
6001 | 6001 |
formdef = create_formdef() |
6002 | 6002 |
formdef.data_class().wipe() |
6003 | 6003 | |
... | ... | |
6047 | 6047 | |
6048 | 6048 | |
6049 | 6049 |
def test_item_field_autocomplete_cards_source(pub): |
6050 |
user = create_user(pub)
|
|
6050 |
create_user(pub) |
|
6051 | 6051 |
formdef = create_formdef() |
6052 | 6052 |
formdef.data_class().wipe() |
6053 | 6053 | |
... | ... | |
6376 | 6376 | |
6377 | 6377 | |
6378 | 6378 |
def test_user_global_action(pub): |
6379 |
user = create_user(pub)
|
|
6379 |
create_user(pub) |
|
6380 | 6380 | |
6381 | 6381 |
workflow = Workflow.get_default_workflow() |
6382 | 6382 |
workflow.id = '2' |
... | ... | |
6422 | 6422 | |
6423 | 6423 | |
6424 | 6424 |
def test_user_global_action_same_status_store(pub): |
6425 |
user = create_user(pub)
|
|
6425 |
create_user(pub) |
|
6426 | 6426 | |
6427 | 6427 |
workflow = Workflow.get_default_workflow() |
6428 | 6428 |
workflow.id = '2' |
... | ... | |
6479 | 6479 | |
6480 | 6480 | |
6481 | 6481 |
def test_condition_on_action(pub, emails): |
6482 |
user = create_user(pub)
|
|
6482 |
create_user(pub) |
|
6483 | 6483 | |
6484 | 6484 |
workflow = Workflow.get_default_workflow() |
6485 | 6485 |
# change email subjects to differentiate them |
... | ... | |
6540 | 6540 |
def test_user_global_action_along_form(pub): |
6541 | 6541 |
# check it's possible to click on a global action button even if there's a |
6542 | 6542 |
# form with required fields. |
6543 |
user = create_user(pub)
|
|
6543 |
create_user(pub) |
|
6544 | 6544 | |
6545 | 6545 |
workflow = Workflow.get_default_workflow() |
6546 | 6546 |
workflow.id = '2' |
... | ... | |
6592 | 6592 | |
6593 | 6593 | |
6594 | 6594 |
def test_email_actions(pub, emails): |
6595 |
user = create_user(pub)
|
|
6595 |
create_user(pub) |
|
6596 | 6596 | |
6597 | 6597 |
workflow = Workflow.get_default_workflow() |
6598 | 6598 |
workflow.id = '2' |
... | ... | |
7022 | 7022 |
] |
7023 | 7023 |
formdef.store() |
7024 | 7024 | |
7025 |
user = create_user(pub)
|
|
7025 |
create_user(pub) |
|
7026 | 7026 |
app = login(get_app(pub), username='foo', password='foo') |
7027 | 7027 |
resp = app.get('/foo/') |
7028 | 7028 |
assert 'f1$element0' in resp.form.fields |
... | ... | |
8230 | 8230 | |
8231 | 8231 | |
8232 | 8232 |
def test_choice_button_ignore_form_errors(pub): |
8233 |
user = create_user(pub)
|
|
8233 |
create_user(pub) |
|
8234 | 8234 | |
8235 | 8235 |
formdef = create_formdef() |
8236 | 8236 |
formdef.roles = [logged_users_role().id] |
tests/test_convert_to_sql.py | ||
---|---|---|
101 | 101 | |
102 | 102 | |
103 | 103 |
def test_already_migrated_fails(): |
104 |
pub = create_temporary_pub(sql_mode=True)
|
|
104 |
create_temporary_pub(sql_mode=True) |
|
105 | 105 |
with pytest.raises(CommandError) as excinfo: |
106 | 106 |
call_command('convert_to_sql', '-d', 'example.net', '--database', 'foobar') |
107 | 107 |
assert str(excinfo.value) == 'tenant already using postgresql' |
tests/test_formdata.py | ||
---|---|---|
513 | 513 |
wf.backoffice_fields_formdef.fields = [ |
514 | 514 |
fields.StringField(id='bo1', label='1st backoffice field', type='string', varname='backoffice_blah'), |
515 | 515 |
] |
516 |
st1 = wf.add_status('Status1')
|
|
516 |
wf.add_status('Status1') |
|
517 | 517 |
wf.store() |
518 | 518 | |
519 | 519 |
formdef.workflow_id = wf.id |
... | ... | |
940 | 940 |
def test_lazy_formdata_queryset(pub, variable_test_data): |
941 | 941 |
lazy_formdata = variable_test_data |
942 | 942 |
data_class = lazy_formdata._formdef.data_class() |
943 |
for i in range(6):
|
|
943 |
for _ in range(6):
|
|
944 | 944 |
formdata = data_class() |
945 | 945 |
formdata.just_created() |
946 | 946 |
formdata.store() |
947 |
for i in range(4):
|
|
947 |
for _ in range(4):
|
|
948 | 948 |
formdata = data_class() |
949 | 949 |
formdata.just_created() |
950 | 950 |
formdata.jump_status('finished') |
... | ... | |
1101 | 1101 |
formdef.workflow = wf |
1102 | 1102 |
formdef.store() |
1103 | 1103 |
data_class = lazy_formdata._formdef.data_class() |
1104 |
for i in range(6):
|
|
1104 |
for _ in range(6):
|
|
1105 | 1105 |
formdata = data_class() |
1106 | 1106 |
formdata.data = {'0': 'bar', '1': True, 'bo1': 'plop1', '10': '3'} |
1107 | 1107 |
formdata.just_created() |
1108 | 1108 |
formdata.store() |
1109 |
for i in range(4):
|
|
1109 |
for _ in range(4):
|
|
1110 | 1110 |
formdata = data_class() |
1111 | 1111 |
formdata.data = { |
1112 | 1112 |
'0': 'foo', |
... | ... | |
1523 | 1523 |
pub.substitutions.reset() |
1524 | 1524 |
pub.substitutions.feed(formdef) |
1525 | 1525 |
pub.substitutions.feed(formdata) |
1526 |
for mode in (None, 'lazy'): |
|
1527 |
pub.substitutions.reset() |
|
1528 |
pub.substitutions.feed(formdata) |
|
1529 |
assert WorkflowStatusItem.compute('{{ form_var_foo_foo|length }}') == '3' |
|
1530 |
assert WorkflowStatusItem.compute('{% if form_var_foo_foo|length_is:3 %}ok{% endif %}') == 'ok' |
|
1531 |
assert ( |
|
1532 |
WorkflowStatusItem.compute( |
|
1533 |
'{% if form_var_foo_foo|length_is:form_var_foo_foo_baz_baz %}ok{% endif %}' |
|
1534 |
) |
|
1535 |
== 'ok' |
|
1526 |
assert WorkflowStatusItem.compute('{{ form_var_foo_foo|length }}') == '3' |
|
1527 |
assert WorkflowStatusItem.compute('{% if form_var_foo_foo|length_is:3 %}ok{% endif %}') == 'ok' |
|
1528 |
assert ( |
|
1529 |
WorkflowStatusItem.compute( |
|
1530 |
'{% if form_var_foo_foo|length_is:form_var_foo_foo_baz_baz %}ok{% endif %}' |
|
1536 | 1531 |
) |
1532 |
== 'ok' |
|
1533 |
) |
|
1537 | 1534 | |
1538 | 1535 | |
1539 | 1536 |
def test_lazy_map_variable(pub, variable_test_data): |
tests/test_formdef.py | ||
---|---|---|
341 | 341 |
clean_unused_files(pub) |
342 | 342 |
assert os.listdir(os.path.join(pub.app_dir, 'uploads')) == [] |
343 | 343 | |
344 |
for i in range(5):
|
|
344 |
for _ in range(5):
|
|
345 | 345 |
formdata = formdef.data_class()() |
346 | 346 |
formdata.just_created() |
347 | 347 |
formdata.data = { |
... | ... | |
574 | 574 |
formdef.store() |
575 | 575 | |
576 | 576 |
formdef_id = formdef.id |
577 |
workflow_id = workflow.id |
|
578 | 577 |
formdef_filename = os.path.join(formdef.get_objects_dir(), str(formdef.id)) |
579 | 578 |
workflow_filename = os.path.join(workflow.get_objects_dir(), str(workflow.id)) |
580 | 579 |
tests/test_formdef_import.py | ||
---|---|---|
288 | 288 |
assert f2.workflow_id == formdef.workflow_id |
289 | 289 | |
290 | 290 |
formdef_xml_with_id = formdef.export_to_xml(include_id=True) |
291 |
formdef_xml_without_id = formdef.export_to_xml(include_id=False) |
|
292 | 291 | |
293 | 292 |
# check there's no reference to a non-existing workflow |
294 | 293 |
Workflow.wipe() |
... | ... | |
323 | 322 |
assert f2.category_id == formdef.category_id |
324 | 323 | |
325 | 324 |
formdef_xml_with_id = formdef.export_to_xml(include_id=True) |
326 |
formdef_xml_without_id = formdef.export_to_xml(include_id=False) |
|
327 | 325 | |
328 | 326 |
# check there's no reference to a non-existing category |
329 | 327 |
Category.wipe() |
... | ... | |
551 | 549 |
assert fd2.workflow_roles.get('_receiver') == role.id |
552 | 550 | |
553 | 551 |
xml_export = export_to_indented_xml(formdef, include_id=True) |
554 |
xml_export_no_id = export_to_indented_xml(formdef, include_id=False) |
|
555 | 552 | |
556 | 553 |
# same id, different name |
557 | 554 |
role.name = 'blah 2' |
tests/test_hobo.py | ||
---|---|---|
301 | 301 | |
302 | 302 |
formdef = UserFieldsFormDef(pub) |
303 | 303 |
field_labels = [force_str(x.get('label')) for x in profile.get('fields') if not x.get('disabled')] |
304 |
field_ids = [x.get('name') for x in profile.get('fields') if not x.get('disabled')] |
|
305 | 304 |
assert [x.label for x in formdef.fields] == field_labels |
306 | 305 |
for field_id in [pub.cfg['users']['field_email']] + pub.cfg['users']['field_name']: |
307 | 306 |
assert field_id in [x.id for x in formdef.fields] |
tests/test_misc.py | ||
---|---|---|
304 | 304 | |
305 | 305 | |
306 | 306 |
def test_get_as_datetime(): |
307 |
pub = create_temporary_pub()
|
|
307 |
create_temporary_pub() |
|
308 | 308 |
datetime_value = datetime.datetime(2017, 4, 25, 12, 0) |
309 | 309 |
assert get_as_datetime('2017-04-25 12:00') == datetime_value |
310 | 310 |
assert get_as_datetime('2017-04-25 12:00:00') == datetime_value |
... | ... | |
474 | 474 | |
475 | 475 | |
476 | 476 |
def test_email_plain_with_attachments(emails): |
477 |
pub = create_temporary_pub()
|
|
477 |
create_temporary_pub() |
|
478 | 478 | |
479 | 479 |
jpg = PicklableUpload('test.jpeg', 'image/jpeg') |
480 | 480 |
jpg_content = open(os.path.join(os.path.dirname(__file__), 'image-with-gps-data.jpeg'), 'rb').read() |
... | ... | |
601 | 601 |
assert emails.emails['test']['msg'].get_content_subtype() == 'alternative' |
602 | 602 |
assert emails.emails['test']['msg'].get_payload()[0].get_content_type() == 'text/plain' |
603 | 603 |
assert emails.emails['test']['msg'].get_payload()[1].get_content_type() == 'text/html' |
604 |
text = emails.emails['test']['msg'].get_payload()[0].get_payload(decode=True) |
|
605 | 604 |
html = emails.emails['test']['msg'].get_payload()[1].get_payload(decode=True) |
606 | 605 |
assert html.count(b'<ol') == 1 |
607 | 606 |
assert not b'<ul' in html |
... | ... | |
611 | 610 | |
612 | 611 |
@pytest.mark.skipif('docutils is None') |
613 | 612 |
def test_email_with_unexpected_transition(emails): |
614 |
pub = create_temporary_pub()
|
|
613 |
create_temporary_pub() |
|
615 | 614 |
mail_body = ''' |
616 | 615 |
Value: |
617 | 616 |
A |
tests/test_publisher.py | ||
---|---|---|
72 | 72 | |
73 | 73 |
def test_finish_failed_request(): |
74 | 74 |
pub.USE_LONG_TRACES = False |
75 |
try: |
|
76 |
raise Exception('foo') |
|
77 |
except Exception: |
|
78 |
exc_type, exc_value, tb = sys.exc_info() |
|
79 | 75 | |
80 | 76 |
req = get_request() |
81 | 77 |
pub._set_request(req) |
tests/test_rootdirectory.py | ||
---|---|---|
82 | 82 |
formdef1.store() |
83 | 83 |
formdef2.store() |
84 | 84 |
with pytest.raises(wcs.forms.root.errors.AccessUnauthorizedError): |
85 |
output = indexhtml()
|
|
85 |
indexhtml() |
|
86 | 86 | |
87 | 87 | |
88 | 88 |
def test_semi_private_site_anonymous_access(): |
... | ... | |
113 | 113 |
formdef1.store() |
114 | 114 |
formdef2.store() |
115 | 115 |
with pytest.raises(wcs.forms.root.errors.AccessUnauthorizedError): |
116 |
output = indexhtml(user2)
|
|
116 |
indexhtml(user2) |
|
117 | 117 | |
118 | 118 | |
119 | 119 |
def test_private_site_semi_authorized_access(): |
tests/test_saml_auth.py | ||
---|---|---|
237 | 237 |
def test_assertion_consumer(pub): |
238 | 238 |
req = get_assertion_consumer_request(pub) |
239 | 239 |
saml2 = Saml2Directory() |
240 |
body = saml2.assertionConsumerPost()
|
|
240 |
saml2.assertionConsumerPost() |
|
241 | 241 | |
242 | 242 |
assert req.response.status_code == 303 |
243 | 243 |
assert req.response.headers['location'] == 'http://example.net' |
... | ... | |
247 | 247 |
def test_assertion_consumer_unspecified(pub): |
248 | 248 |
req = get_assertion_consumer_request(pub, ni_format=lasso.SAML2_NAME_IDENTIFIER_FORMAT_UNSPECIFIED) |
249 | 249 |
saml2 = Saml2Directory() |
250 |
body = saml2.assertionConsumerPost()
|
|
250 |
saml2.assertionConsumerPost() |
|
251 | 251 | |
252 | 252 |
assert req.response.status_code == 303 |
253 | 253 |
assert req.response.headers['location'] == 'http://example.net' |
... | ... | |
321 | 321 |
req = get_assertion_consumer_request(pub) |
322 | 322 |
req.form['RelayState'] = '/foobar/?test=ok' |
323 | 323 |
saml2 = Saml2Directory() |
324 |
saml_response_body = req.form['SAMLResponse'] |
|
325 |
body = saml2.assertionConsumerPost() |
|
324 |
saml2.assertionConsumerPost() |
|
326 | 325 |
assert req.response.status_code == 303 |
327 | 326 |
assert req.response.headers['location'] == 'http://example.net/foobar/?test=ok' |
328 | 327 | |
... | ... | |
331 | 330 |
req = get_assertion_consumer_request(pub) |
332 | 331 |
req.form['RelayState'] = 'http://example.net/foobar/?test=ok' |
333 | 332 |
saml2 = Saml2Directory() |
334 |
saml_response_body = req.form['SAMLResponse'] |
|
335 |
body = saml2.assertionConsumerPost() |
|
333 |
saml2.assertionConsumerPost() |
|
336 | 334 |
assert req.response.status_code == 303 |
337 | 335 |
assert req.response.headers['location'] == 'http://example.net/foobar/?test=ok' |
338 | 336 | |
... | ... | |
341 | 339 |
req = get_assertion_consumer_request(pub) |
342 | 340 |
req.form['RelayState'] = 'http://example.org/foobar/?test=ok' |
343 | 341 |
saml2 = Saml2Directory() |
344 |
saml_response_body = req.form['SAMLResponse'] |
|
345 | 342 |
with pytest.raises(RequestError): |
346 |
body = saml2.assertionConsumerPost()
|
|
343 |
saml2.assertionConsumerPost() |
|
347 | 344 | |
348 | 345 | |
349 | 346 |
def test_saml_login_page(pub): |
... | ... | |
452 | 449 |
saml2 = Saml2Directory() |
453 | 450 |
saml2.assertionConsumerPost() |
454 | 451 |
assert req.session.user is not None |
455 |
body = saml2.slo_sp()
|
|
452 |
saml2.slo_sp() |
|
456 | 453 |
assert req.response.headers['location'].startswith('http://sso.example.net/saml2/slo?SAMLRequest=') |
457 | 454 |
assert 'rsa-sha256' in req.response.headers['location'] |
458 | 455 |
assert req.session.user is None |
tests/test_sql.py | ||
---|---|---|
65 | 65 | |
66 | 66 |
@postgresql |
67 | 67 |
def test_sql_data_class(): |
68 |
data_class = formdef.data_class(mode='sql')
|
|
68 |
formdef.data_class(mode='sql') |
|
69 | 69 | |
70 | 70 | |
71 | 71 |
@postgresql |
... | ... | |
365 | 365 | |
366 | 366 |
formdata = data_class() |
367 | 367 |
formdata.store() |
368 |
id1 = formdata.id |
|
369 | 368 | |
370 | 369 |
formdata = data_class() |
371 | 370 |
formdata.user_id = '2' |
... | ... | |
426 | 425 | |
427 | 426 |
formdata = data_class() |
428 | 427 |
formdata.store() |
429 |
id1 = formdata.id |
|
430 | 428 | |
431 | 429 |
formdata = data_class() |
432 | 430 |
formdata.workflow_roles = {'plop': '2'} |
... | ... | |
506 | 504 |
user.name = 'Pierre' |
507 | 505 |
user.roles = [1] |
508 | 506 |
user.store() |
509 |
user_id = user.id |
|
510 | 507 | |
511 | 508 |
user = sql.SqlUser() |
512 | 509 |
user.name = 'Papier' |
... | ... | |
523 | 520 |
user.name = 'Pierre' |
524 | 521 |
user.name_identifiers = ['foo'] |
525 | 522 |
user.store() |
526 |
user_id = user.id |
|
527 | 523 | |
528 | 524 |
user = sql.SqlUser() |
529 | 525 |
user.name = 'Papier' |
... | ... | |
713 | 709 |
data_class = test_formdef.data_class(mode='sql') |
714 | 710 |
assert data_class.count() == 0 |
715 | 711 | |
716 |
for i in range(50):
|
|
712 |
for _ in range(50):
|
|
717 | 713 |
t = data_class() |
718 | 714 |
t.store() |
719 | 715 | |
... | ... | |
744 | 740 |
data_class = test_formdef.data_class(mode='sql') |
745 | 741 |
assert data_class.count() == 0 |
746 | 742 | |
747 |
for i in range(50):
|
|
743 |
for _ in range(50):
|
|
748 | 744 |
t = data_class() |
749 | 745 |
t.store() |
750 | 746 | |
... | ... | |
809 | 805 |
data_class = test_formdef.data_class(mode='sql') |
810 | 806 |
assert data_class.count() == 0 |
811 | 807 | |
812 |
for i in range(50):
|
|
808 |
for _ in range(50):
|
|
813 | 809 |
t = data_class() |
814 | 810 |
t.store() |
815 | 811 | |
... | ... | |
872 | 868 |
data_class = test_formdef.data_class(mode='sql') |
873 | 869 |
assert data_class.count() == 0 |
874 | 870 | |
875 |
for i in range(50):
|
|
871 |
for _ in range(50):
|
|
876 | 872 |
t = data_class() |
877 | 873 |
t.store() |
878 | 874 | |
... | ... | |
889 | 885 |
data_class = test_formdef.data_class(mode='sql') |
890 | 886 |
assert data_class.count() == 0 |
891 | 887 | |
892 |
for i in range(50):
|
|
888 |
for _ in range(50):
|
|
893 | 889 |
t = data_class() |
894 | 890 |
t.store() |
895 | 891 | |
... | ... | |
935 | 931 |
data_class = test_formdef.data_class(mode='sql') |
936 | 932 |
assert data_class.count() == 0 |
937 | 933 | |
938 |
for i in range(50):
|
|
934 |
for _ in range(50):
|
|
939 | 935 |
t = data_class() |
940 | 936 |
t.data = {'3': False} |
941 | 937 |
t.store() |
... | ... | |
1328 | 1324 | |
1329 | 1325 | |
1330 | 1326 |
def drop_formdef_tables(): |
1331 |
conn, cur = sql.get_connection_and_cursor()
|
|
1327 |
_, cur = sql.get_connection_and_cursor()
|
|
1332 | 1328 |
cur.execute('''SELECT table_name FROM information_schema.tables''') |
1333 | 1329 |
table_names = [] |
1334 | 1330 |
while True: |
... | ... | |
1344 | 1340 |
@postgresql |
1345 | 1341 |
def test_is_at_endpoint(): |
1346 | 1342 |
drop_formdef_tables() |
1347 |
conn, cur = sql.get_connection_and_cursor()
|
|
1343 |
_, cur = sql.get_connection_and_cursor()
|
|
1348 | 1344 | |
1349 | 1345 |
wf = Workflow(name='test endpoint') |
1350 | 1346 |
st1 = wf.add_status('Status1', 'st1') |
1351 |
st2 = wf.add_status('Status2', 'st2')
|
|
1347 |
wf.add_status('Status2', 'st2') |
|
1352 | 1348 | |
1353 | 1349 |
commentable = CommentableWorkflowStatusItem() |
1354 | 1350 |
commentable.id = '_commentable' |
... | ... | |
1393 | 1389 |
@postgresql |
1394 | 1390 |
def test_views_fts(): |
1395 | 1391 |
drop_formdef_tables() |
1396 |
conn, cur = sql.get_connection_and_cursor()
|
|
1392 |
_, cur = sql.get_connection_and_cursor()
|
|
1397 | 1393 | |
1398 | 1394 |
formdef = FormDef() |
1399 | 1395 |
formdef.name = 'test fts' |
... | ... | |
1421 | 1417 |
@postgresql |
1422 | 1418 |
def test_select_any_formdata(): |
1423 | 1419 |
drop_formdef_tables() |
1424 |
conn, cur = sql.get_connection_and_cursor() |
|
1425 | 1420 | |
1426 | 1421 |
now = datetime.datetime.now() |
1427 | 1422 | |
... | ... | |
1482 | 1477 |
@postgresql |
1483 | 1478 |
def test_load_all_evolutions_on_any_formdata(): |
1484 | 1479 |
drop_formdef_tables() |
1485 |
conn, cur = sql.get_connection_and_cursor() |
|
1486 | 1480 | |
1487 | 1481 |
now = datetime.datetime.now() |
1488 | 1482 | |
... | ... | |
1514 | 1508 |
@postgresql |
1515 | 1509 |
def test_geoloc_in_global_view(): |
1516 | 1510 |
drop_formdef_tables() |
1517 |
conn, cur = sql.get_connection_and_cursor() |
|
1518 | ||
1519 |
now = datetime.datetime.now() |
|
1520 | 1511 | |
1521 | 1512 |
formdef = FormDef() |
1522 | 1513 |
formdef.name = 'test no geoloc' |
... | ... | |
1558 | 1549 |
@postgresql |
1559 | 1550 |
def test_actions_roles(): |
1560 | 1551 |
drop_formdef_tables() |
1561 |
conn, cur = sql.get_connection_and_cursor()
|
|
1552 |
_, cur = sql.get_connection_and_cursor()
|
|
1562 | 1553 | |
1563 | 1554 |
wf = Workflow(name='test endpoint') |
1564 | 1555 |
st1 = wf.add_status('Status1', 'st1') |
1565 |
st2 = wf.add_status('Status2', 'st2')
|
|
1556 |
wf.add_status('Status2', 'st2') |
|
1566 | 1557 | |
1567 | 1558 |
commentable = CommentableWorkflowStatusItem() |
1568 | 1559 |
commentable.id = '_commentable' |
... | ... | |
1624 | 1615 |
@postgresql |
1625 | 1616 |
def test_last_update_time(): |
1626 | 1617 |
drop_formdef_tables() |
1627 |
conn, cur = sql.get_connection_and_cursor()
|
|
1618 |
_, cur = sql.get_connection_and_cursor()
|
|
1628 | 1619 | |
1629 | 1620 |
wf = Workflow(name='test last update time') |
1630 | 1621 |
st1 = wf.add_status('Status1', 'st1') |
... | ... | |
1674 | 1665 |
@postgresql |
1675 | 1666 |
def test_view_formdef_name(): |
1676 | 1667 |
drop_formdef_tables() |
1677 |
conn, cur = sql.get_connection_and_cursor()
|
|
1668 |
_, cur = sql.get_connection_and_cursor()
|
|
1678 | 1669 | |
1679 | 1670 |
formdef1 = FormDef() |
1680 | 1671 |
formdef1.name = 'test formdef name 1' |
... | ... | |
1709 | 1700 |
@postgresql |
1710 | 1701 |
def test_view_user_name(): |
1711 | 1702 |
drop_formdef_tables() |
1712 |
conn, cur = sql.get_connection_and_cursor()
|
|
1703 |
_, cur = sql.get_connection_and_cursor()
|
|
1713 | 1704 | |
1714 | 1705 |
formdef1 = FormDef() |
1715 | 1706 |
formdef1.name = 'test user name' |
... | ... | |
1742 | 1733 |
@postgresql |
1743 | 1734 |
def test_select_formdata_after_formdef_removal(): |
1744 | 1735 |
drop_formdef_tables() |
1745 |
conn, cur = sql.get_connection_and_cursor() |
|
1746 | 1736 | |
1747 |
now = datetime.datetime.now() |
|
1748 | ||
1749 |
for i in range(2): |
|
1737 |
for _ in range(2): |
|
1750 | 1738 |
formdef = FormDef() |
1751 | 1739 |
formdef.name = 'test formdef removal' |
1752 | 1740 |
formdef.fields = [] |
... | ... | |
1770 | 1758 |
@postgresql |
1771 | 1759 |
def test_views_submission_info(): |
1772 | 1760 |
drop_formdef_tables() |
1773 |
conn, cur = sql.get_connection_and_cursor()
|
|
1761 |
_, cur = sql.get_connection_and_cursor()
|
|
1774 | 1762 | |
1775 | 1763 |
formdef = FormDef() |
1776 | 1764 |
formdef.name = 'test backoffice submission' |
... | ... | |
1818 | 1806 |
@postgresql |
1819 | 1807 |
def test_criticality_levels(): |
1820 | 1808 |
drop_formdef_tables() |
1821 |
conn, cur = sql.get_connection_and_cursor() |
|
1822 | 1809 | |
1823 | 1810 |
workflow1 = Workflow(name='criticality1') |
1824 | 1811 |
workflow1.criticality_levels = [ |
... | ... | |
1875 | 1862 |
pytest.skip('takes too much time') |
1876 | 1863 | |
1877 | 1864 |
drop_formdef_tables() |
1878 |
conn, cur = sql.get_connection_and_cursor() |
|
1879 | ||
1880 | 1865 |
nb_users = 1000 |
1881 | 1866 |
nb_roles = 10 |
1882 | 1867 |
nb_workflows = 5 |
... | ... | |
1964 | 1949 |
criterias.append(st.NotEqual('status', 'draft')) |
1965 | 1950 |
criterias.append(st.Equal('is_at_endpoint', False)) |
1966 | 1951 |
criterias.append(st.Intersects('actions_roles_array', user_roles)) |
1967 |
formdatas = sql.AnyFormData.select(criterias, order_by='receipt_time', limit=20, offset=0)
|
|
1952 |
sql.AnyFormData.select(criterias, order_by='receipt_time', limit=20, offset=0) |
|
1968 | 1953 |
print(time.time() - t0) |
1969 | 1954 |
assert (time.time() - t0) < 0.5 |
1970 | 1955 |
tests/test_storage.py | ||
---|---|---|
255 | 255 |
def test_select_limit_offset(): |
256 | 256 |
Foobar.wipe() |
257 | 257 | |
258 |
for x in range(50):
|
|
258 |
for _ in range(50):
|
|
259 | 259 |
test = Foobar() |
260 | 260 |
test.store() |
261 | 261 | |
... | ... | |
384 | 384 |
def test_items(): |
385 | 385 |
Foobar.wipe() |
386 | 386 | |
387 |
for x in range(50):
|
|
387 |
for _ in range(50):
|
|
388 | 388 |
test = Foobar() |
389 | 389 |
test.store() |
390 | 390 | |
... | ... | |
394 | 394 |
def test_reversed_order(): |
395 | 395 |
Foobar.wipe() |
396 | 396 | |
397 |
for x in range(50):
|
|
397 |
for _ in range(50):
|
|
398 | 398 |
test = Foobar() |
399 | 399 |
test.store() |
400 | 400 | |
... | ... | |
427 | 427 |
if pid: |
428 | 428 |
children_pids.append(pid) |
429 | 429 |
else: |
430 |
for j in range(10):
|
|
430 |
for _ in range(10):
|
|
431 | 431 |
test = Foobar() |
432 | 432 |
test.value = 'x' |
433 | 433 |
test.dict_value = {'plop': random.randint(0, 10)} |
tests/test_users.py | ||
---|---|---|
26 | 26 |
user.name = 'Pierre' |
27 | 27 |
user.name_identifiers = ['foo'] |
28 | 28 |
user.store() |
29 |
user_id = user.id |
|
30 | 29 | |
31 | 30 |
user = pub.user_class() |
32 | 31 |
user.name = 'Papier' |
... | ... | |
62 | 61 |
user.name = 'Pierre' |
63 | 62 |
user.roles = [1] |
64 | 63 |
user.store() |
65 |
user_id = user.id |
|
66 | 64 | |
67 | 65 |
user = pub.user_class() |
68 | 66 |
user.name = 'Papier' |
tests/test_widgets.py | ||
---|---|---|
163 | 163 |
def test_table_list_rows_required(): |
164 | 164 |
req.form = {} |
165 | 165 |
widget = TableListRowsWidget('test', columns=['a', 'b', 'c'], required=True) |
166 |
form = MockHtmlForm(widget) |
|
167 | 166 |
mock_form_submission(req, widget) |
168 | 167 |
widget = TableListRowsWidget('test', columns=['a', 'b', 'c'], required=True) |
169 | 168 |
assert widget.has_error() |
... | ... | |
624 | 623 |
widget.add(StringWidget, name='str1') |
625 | 624 |
widget.add(StringWidget, name='str2', required=True) |
626 | 625 |
req.form = {'compotest$str1': 'foo1', 'compotest$str2': 'foo2'} |
627 |
form = MockHtmlForm(widget) |
|
628 | 626 |
assert not widget.has_error() |
629 | 627 |
assert len(widget.widgets) == 2 |
630 | 628 |
assert widget.widgets[0].parse() == 'foo1' |
... | ... | |
634 | 632 |
widget.add(StringWidget, name='str1') |
635 | 633 |
widget.add(StringWidget, name='str2', required=True) |
636 | 634 |
req.form = {'compotest$str1': 'alone'} |
637 |
form = MockHtmlForm(widget) |
|
638 | 635 |
assert widget.has_error() |
639 | 636 |
assert not widget.widgets[0].has_error() |
640 | 637 |
assert widget.widgets[0].parse() == 'alone' |
... | ... | |
652 | 649 | |
653 | 650 |
def test_computed_expression_widget(): |
654 | 651 |
widget = ComputedExpressionWidget('test') |
655 |
form = MockHtmlForm(widget) |
|
656 | 652 |
mock_form_submission(req, widget, {'test$value_text': 'hello world', 'test$type': ['text']}) |
657 | 653 |
assert widget.parse() == 'hello world' |
658 | 654 |
assert not widget.has_error() |
659 | 655 | |
660 | 656 |
widget = ComputedExpressionWidget('test') |
661 |
form = MockHtmlForm(widget) |
|
662 | 657 |
mock_form_submission(req, widget, {'test$value_text': '', 'test$type': ['text']}) |
663 | 658 |
assert widget.parse() == None |
664 | 659 |
assert not widget.has_error() |
tests/test_workflow_import.py | ||
---|---|---|
69 | 69 | |
70 | 70 |
def test_status(pub): |
71 | 71 |
wf = Workflow(name='status') |
72 |
st1 = wf.add_status('Status1', 'st1')
|
|
73 |
st2 = wf.add_status('Status2', 'st2')
|
|
72 |
wf.add_status('Status1', 'st1') |
|
73 |
wf.add_status('Status2', 'st2') |
|
74 | 74 |
assert_import_export_works(wf) |
75 | 75 | |
76 | 76 | |
77 | 77 |
def test_status_actions(pub): |
78 | 78 |
wf = Workflow(name='status') |
79 | 79 |
st1 = wf.add_status('Status1', 'st1') |
80 |
st2 = wf.add_status('Status2', 'st2')
|
|
80 |
wf.add_status('Status2', 'st2') |
|
81 | 81 | |
82 | 82 |
commentable = CommentableWorkflowStatusItem() |
83 | 83 |
commentable.id = '_commentable' |
... | ... | |
93 | 93 |
st1 = wf.add_status('Status1', 'st1') |
94 | 94 |
st1.extra_css_class = 'hello' |
95 | 95 |
st1.colour = 'FF0000' |
96 |
st2 = wf.add_status('Status2', 'st2')
|
|
96 |
wf.add_status('Status2', 'st2') |
|
97 | 97 |
assert_import_export_works(wf) |
98 | 98 | |
99 | 99 | |
... | ... | |
101 | 101 |
wf = Workflow(name='status') |
102 | 102 |
st1 = wf.add_status('Status1', 'st1') |
103 | 103 |
st1.forced_endpoint = True |
104 |
st2 = wf.add_status('Status2', 'st2')
|
|
104 |
wf.add_status('Status2', 'st2') |
|
105 | 105 |
wf2 = assert_import_export_works(wf) |
106 | 106 |
assert wf2.possible_status[0].forced_endpoint is True |
107 | 107 |
assert wf2.possible_status[1].forced_endpoint is False |
... | ... | |
161 | 161 |
def test_status_actions_named_role(pub): |
162 | 162 |
wf = Workflow(name='status') |
163 | 163 |
st1 = wf.add_status('Status1', 'st1') |
164 |
st2 = wf.add_status('Status2', 'st2')
|
|
164 |
wf.add_status('Status2', 'st2') |
|
165 | 165 | |
166 | 166 |
commentable = CommentableWorkflowStatusItem() |
167 | 167 |
commentable.id = '_commentable' |
... | ... | |
180 | 180 | |
181 | 181 |
wf = Workflow(name='status') |
182 | 182 |
st1 = wf.add_status('Status1', 'st1') |
183 |
st2 = wf.add_status('Status2', 'st2')
|
|
183 |
wf.add_status('Status2', 'st2') |
|
184 | 184 | |
185 | 185 |
commentable = CommentableWorkflowStatusItem() |
186 | 186 |
commentable.id = '_commentable' |
... | ... | |
217 | 217 | |
218 | 218 |
wf = Workflow(name='status') |
219 | 219 |
st1 = wf.add_status('Status1', 'st1') |
220 |
st2 = wf.add_status('Status2', 'st2')
|
|
220 |
wf.add_status('Status2', 'st2') |
|
221 | 221 | |
222 | 222 |
commentable = CommentableWorkflowStatusItem() |
223 | 223 |
commentable.id = '_commentable' |
... | ... | |
225 | 225 |
st1.items.append(commentable) |
226 | 226 |
commentable.parent = st1 |
227 | 227 | |
228 |
wf2 = assert_import_export_works(wf)
|
|
228 |
assert_import_export_works(wf) |
|
229 | 229 | |
230 | 230 |
# check that role name has precedence over id |
231 | 231 |
xml_export_orig = ET.tostring(export_to_indented_xml(wf)) |
... | ... | |
339 | 339 |
def test_jump_action(pub): |
340 | 340 |
wf = Workflow(name='status') |
341 | 341 |
st1 = wf.add_status('Status1', 'st1') |
342 |
st2 = wf.add_status('Status2', 'st2')
|
|
342 |
wf.add_status('Status2', 'st2') |
|
343 | 343 | |
344 | 344 |
jump = JumpWorkflowStatusItem() |
345 | 345 |
jump.id = '_jump' |
... | ... | |
518 | 518 |
wf.backoffice_fields_formdef.fields = [ |
519 | 519 |
StringField(id='bo1', label='1st backoffice field', type='string', varname='backoffice_blah'), |
520 | 520 |
] |
521 |
wf2 = assert_import_export_works(wf, True)
|
|
521 |
assert_import_export_works(wf, True) |
|
522 | 522 | |
523 | 523 | |
524 | 524 |
def test_complex_dispatch_action(pub): |
tests/test_workflows.py | ||
---|---|---|
331 | 331 |
item.condition = {'type': 'python', 'value': 'form_objects.count < 2'} |
332 | 332 |
assert item.must_jump(formdata) is True |
333 | 333 | |
334 |
for i in range(10):
|
|
334 |
for _ in range(10):
|
|
335 | 335 |
formdata = formdef.data_class()() |
336 | 336 |
formdata.store() |
337 | 337 | |
... | ... | |
1670 | 1670 | |
1671 | 1671 |
wf = Workflow(name='wf1') |
1672 | 1672 |
st1 = wf.add_status('Status1', 'st1') |
1673 |
sterr = wf.add_status('StatusErr', 'sterr')
|
|
1673 |
wf.add_status('StatusErr', 'sterr') |
|
1674 | 1674 |
wf.store() |
1675 | 1675 | |
1676 | 1676 |
FormDef.wipe() |
... | ... | |
2351 | 2351 |
pub.substitutions.feed(MockSubstitutionVariables()) |
2352 | 2352 | |
2353 | 2353 |
wf = Workflow(name='wf1') |
2354 |
st1 = wf.add_status('Status1', 'st1')
|
|
2355 |
sterr = wf.add_status('StatusErr', 'sterr')
|
|
2354 |
wf.add_status('Status1', 'st1') |
|
2355 |
wf.add_status('StatusErr', 'sterr') |
|
2356 | 2356 |
wf.store() |
2357 | 2357 | |
2358 | 2358 |
datasource = { |
... | ... | |
2469 | 2469 |
def test_timeout(two_pubs): |
2470 | 2470 |
workflow = Workflow(name='timeout') |
2471 | 2471 |
st1 = workflow.add_status('Status1', 'st1') |
2472 |
st2 = workflow.add_status('Status2', 'st2')
|
|
2472 |
workflow.add_status('Status2', 'st2') |
|
2473 | 2473 | |
2474 | 2474 |
jump = JumpWorkflowStatusItem() |
2475 | 2475 |
jump.id = '_jump' |
... | ... | |
2508 | 2508 |
def test_legacy_timeout(pub): |
2509 | 2509 |
workflow = Workflow(name='timeout') |
2510 | 2510 |
st1 = workflow.add_status('Status1', 'st1') |
2511 |
st2 = workflow.add_status('Status2', 'st2')
|
|
2511 |
workflow.add_status('Status2', 'st2') |
|
2512 | 2512 | |
2513 | 2513 |
jump = TimeoutWorkflowStatusItem() |
2514 | 2514 |
jump.id = '_jump' |
... | ... | |
2579 | 2579 |
def test_timeout_with_mark(two_pubs): |
2580 | 2580 |
workflow = Workflow(name='timeout') |
2581 | 2581 |
st1 = workflow.add_status('Status1', 'st1') |
2582 |
st2 = workflow.add_status('Status2', 'st2')
|
|
2582 |
workflow.add_status('Status2', 'st2') |
|
2583 | 2583 | |
2584 | 2584 |
jump = JumpWorkflowStatusItem() |
2585 | 2585 |
jump.id = '_jump' |
... | ... | |
3679 | 3679 |
WorkflowCriticalityLevel(name='red'), |
3680 | 3680 |
] |
3681 | 3681 |
action = workflow.add_global_action('Timeout Test') |
3682 |
item = action.append_item('modify_criticality')
|
|
3682 |
action.append_item('modify_criticality') |
|
3683 | 3683 |
trigger = action.append_trigger('timeout') |
3684 | 3684 |
trigger.anchor = 'creation' |
3685 | 3685 |
workflow.store() |
... | ... | |
3950 | 3950 |
WorkflowCriticalityLevel(name='red'), |
3951 | 3951 |
] |
3952 | 3952 |
action = workflow.add_global_action('Timeout Test') |
3953 |
item = action.append_item('modify_criticality')
|
|
3953 |
action.append_item('modify_criticality') |
|
3954 | 3954 |
trigger = action.append_trigger('timeout') |
3955 | 3955 |
trigger.anchor = 'latest-arrival' |
3956 | 3956 |
trigger.anchor_status_latest = 'wf-new' |
... | ... | |
6110 | 6110 |
carddata.store() |
6111 | 6111 | |
6112 | 6112 |
wf = Workflow(name='External actions') |
6113 |
st1 = wf.add_status('Action')
|
|
6113 |
wf.add_status('Action') |
|
6114 | 6114 | |
6115 | 6115 |
update_global_action = wf.add_global_action('Update linked object data') |
6116 | 6116 |
update_action = update_global_action.append_item('external_workflow_global_action') |
... | ... | |
6548 | 6548 |
# reset data |
6549 | 6549 |
for expression in ('=None', '', '""'): |
6550 | 6550 |
edit.mappings = [ |
6551 |
Mapping(field_id='2', expression='=None'),
|
|
6551 |
Mapping(field_id='2', expression=expression),
|
|
6552 | 6552 |
] |
6553 | 6553 |
wf.store() |
6554 | 6554 | |
... | ... | |
6559 | 6559 |
formdata.perform_workflow() |
6560 | 6560 | |
6561 | 6561 |
carddata = carddef.data_class().select()[0] |
6562 |
assert carddata.data['2'] is None
|
|
6562 |
assert carddata.data['2'] in [None, '', '""']
|
|
6563 | 6563 |
assert carddata.data.get('2_display') is None |
6564 | 6564 |
assert carddata.data.get('2_structured') is None |
6565 | 6565 |
tests/utilities.py | ||
---|---|---|
159 | 159 |
cur = conn.cursor() |
160 | 160 |
cur.execute('CREATE DATABASE %s' % dbname) |
161 | 161 |
break |
162 |
except psycopg2.Error as e:
|
|
162 |
except psycopg2.Error: |
|
163 | 163 |
if i < 5: |
164 | 164 |
i += 1 |
165 | 165 |
continue |
... | ... | |
344 | 344 |
{'url': url, 'method': method, 'body': body, 'headers': headers, 'timeout': timeout} |
345 | 345 |
) |
346 | 346 | |
347 |
scheme, netloc, path, params, query, fragment = urllib.parse.urlparse(url)
|
|
347 |
scheme, netloc, path = urllib.parse.urlparse(url)[:3]
|
|
348 | 348 |
base_url = urllib.parse.urlunparse((scheme, netloc, path, '', '', '')) |
349 | 349 | |
350 | 350 |
with open(os.path.join(os.path.dirname(__file__), 'idp_metadata.xml')) as fd: |
351 |
- |