32 |
32 |
def test_form_auth(pub, formdef):
|
33 |
33 |
create_user(pub)
|
34 |
34 |
|
35 |
|
resp = get_app(pub).get('/test/auth')
|
36 |
|
assert resp.location == 'http://example.net/login/?ReturnUrl=http%3A//example.net/test/'
|
|
35 |
resp = get_app(pub).get('/test/auth?param1=foo¶m2=bar')
|
|
36 |
assert (
|
|
37 |
resp.location
|
|
38 |
== 'http://example.net/login/?ReturnUrl=http%3A//example.net/test/%3Fparam1%3Dfoo%26param2%3Dbar'
|
|
39 |
)
|
37 |
40 |
|
38 |
|
resp = login(get_app(pub), username='foo', password='foo').get('/test/auth')
|
39 |
|
assert resp.location == 'http://example.net/test/'
|
|
41 |
resp = login(get_app(pub), username='foo', password='foo').get('/test/auth?param1=foo¶m2=bar')
|
|
42 |
assert resp.location == 'http://example.net/test/?param1=foo¶m2=bar'
|
40 |
43 |
|
41 |
44 |
|
42 |
45 |
def test_form_tryauth(pub, formdef):
|
43 |
46 |
create_user(pub)
|
44 |
47 |
|
45 |
|
resp = get_app(pub).get('/test/tryauth')
|
46 |
|
assert resp.location == 'http://example.net/test/'
|
|
48 |
resp = get_app(pub).get('/test/tryauth?param1=foo¶m2=bar')
|
|
49 |
assert resp.location == 'http://example.net/test/?param1=foo¶m2=bar'
|
47 |
50 |
|
48 |
51 |
app = login(get_app(pub), username='foo', password='foo')
|
49 |
52 |
pub.cfg['identification'] = {'methods': ['idp']}
|
50 |
53 |
pub.write_cfg()
|
51 |
54 |
# if the user is logged in, the form should be presented
|
52 |
|
resp = app.get('/test/tryauth')
|
53 |
|
assert resp.location == 'http://example.net/test/'
|
|
55 |
resp = app.get('/test/tryauth?param1=foo¶m2=bar')
|
|
56 |
assert resp.location == 'http://example.net/test/?param1=foo¶m2=bar'
|
54 |
57 |
|
55 |
58 |
# if the user is unlogged, there should be a passive redirection to SSO
|
56 |
59 |
resp = get_app(pub).get('/test/tryauth')
|
... | ... | |
63 |
66 |
def test_form_forceauth(pub, formdef):
|
64 |
67 |
create_user(pub)
|
65 |
68 |
|
66 |
|
resp = get_app(pub).get('/test/forceauth')
|
67 |
|
assert resp.location == 'http://example.net/login/?ReturnUrl=http%3A//example.net/test/&forceAuthn=true'
|
|
69 |
resp = get_app(pub).get('/test/forceauth?param1=foo¶m2=bar')
|
|
70 |
assert resp.location == (
|
|
71 |
'http://example.net/login/'
|
|
72 |
'?ReturnUrl=http%3A//example.net/test/%3Fparam1%3Dfoo%26param2%3Dbar&forceAuthn=true'
|
|
73 |
)
|