5 |
5 |
import re
|
6 |
6 |
import StringIO
|
7 |
7 |
import time
|
|
8 |
from urlparse import urlparse
|
8 |
9 |
import zipfile
|
9 |
10 |
import base64
|
10 |
11 |
from webtest import Upload
|
... | ... | |
1637 |
1638 |
|
1638 |
1639 |
# check it's not set if it's not whitelisted
|
1639 |
1640 |
resp = get_app(pub).get('/?session_var_foo=hello')
|
1640 |
|
assert resp.location == 'http://example.net/'
|
|
1641 |
assert urlparse(resp.location).path == '/'
|
1641 |
1642 |
resp = resp.follow()
|
1642 |
1643 |
resp = resp.click('test')
|
1643 |
1644 |
assert resp.forms[0]['f0'].value == ''
|
... | ... | |
1648 |
1649 |
''')
|
1649 |
1650 |
|
1650 |
1651 |
resp = get_app(pub).get('/?session_var_foo=hello')
|
1651 |
|
assert resp.location == 'http://example.net/'
|
|
1652 |
assert urlparse(resp.location).path == '/'
|
1652 |
1653 |
resp = resp.follow()
|
1653 |
1654 |
resp = resp.click('test')
|
1654 |
1655 |
assert resp.forms[0]['f0'].value == 'hello'
|
1655 |
1656 |
|
1656 |
1657 |
# check it survives a login
|
1657 |
1658 |
resp = get_app(pub).get('/?session_var_foo=hello2')
|
1658 |
|
assert resp.location == 'http://example.net/'
|
|
1659 |
assert urlparse(resp.location).path == '/'
|
1659 |
1660 |
resp = resp.follow()
|
1660 |
1661 |
resp = resp.click('Login')
|
1661 |
1662 |
resp = resp.follow()
|
... | ... | |
1668 |
1669 |
|
1669 |
1670 |
# check repeated options are ignored
|
1670 |
1671 |
resp = get_app(pub).get('/?session_var_foo=hello&session_var_foo=hello2')
|
1671 |
|
assert resp.location == 'http://example.net/'
|
|
1672 |
assert urlparse(resp.location).path == '/'
|
1672 |
1673 |
resp = resp.follow()
|
1673 |
1674 |
resp = resp.click('test')
|
1674 |
1675 |
assert resp.forms[0]['f0'].value == ''
|
1675 |
1676 |
|
1676 |
1677 |
# check extra query string parameters are not lost
|
1677 |
1678 |
resp = get_app(pub).get('/?session_var_foo=hello&foo=bar')
|
1678 |
|
assert resp.location == 'http://example.net/?foo=bar'
|
|
1679 |
assert urlparse(resp.location).path == '/'
|
|
1680 |
assert urlparse(resp.location).query == 'foo=bar'
|
1679 |
1681 |
|
1680 |
1682 |
os.unlink(os.path.join(pub.app_dir, 'site-options.cfg'))
|
1681 |
1683 |
|
1682 |
|
-
|