Changeset 10494 for main/waeup.cas
- Timestamp:
- 13 Aug 2013, 13:40:01 (11 years ago)
- Location:
- main/waeup.cas/trunk/waeup/cas
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
main/waeup.cas/trunk/waeup/cas/server.py
r10493 r10494 5 5 import random 6 6 import time 7 import urllib 8 from urlparse import urlparse, parse_qsl, urlunparse 7 try: 8 from urllib import urlencode # Python 2.x 9 except ImportError: # pragma: no cover 10 from urllib.parse import urlencode # Python 3.x 11 try: 12 from urlparse import urlparse, parse_qsl, urlunparse # Python 2.x 13 except ImportError: # pragma: no cover 14 from urllib.parse import urlparse, parse_qsl, urlunparse # Python 3.x 9 15 from webob import exc, Response 10 16 from webob.dec import wsgify … … 186 192 old_params = dict(parse_qsl(parts[4])) 187 193 old_params.update(params_dict) 188 query_string = url lib.urlencode(old_params)194 query_string = urlencode(old_params) 189 195 parts[4] = query_string 190 196 return urlunparse(parts) -
main/waeup.cas/trunk/waeup/cas/tests/test_server.py
r10492 r10494 5 5 import unittest 6 6 from paste.deploy import loadapp 7 from urlparse import parse_qsl 7 try: 8 from urlparse import parse_qsl # Python 2.x 9 except ImportError: # pragma: no cover 10 from urllib.parse import parse_qsl # Python 3.x 8 11 from webob import Request, Response 9 12 from webtest import TestApp as WebTestApp # avoid py.test skip message … … 569 572 url = 'http://sample.com/index?a=1&b=2' 570 573 result1 = update_url('http://sample.com/index?a=1&b=2', dict(b='3')) 571 assert result1 == 'http://sample.com/index?a=1&b=3' 574 assert result1 in ( 575 'http://sample.com/index?a=1&b=3', 576 'http://sample.com/index?b=3&a=1') 572 577 result2 = update_url('http://sample.com/index?b=2', dict(b='3')) 573 578 assert result2 == 'http://sample.com/index?b=3' … … 575 580 assert result3 == 'http://sample.com/index?b=3' 576 581 result4 = update_url('http://sample.com/index?a=2', dict(b='3')) 577 assert result4 == 'http://sample.com/index?a=2&b=3' 582 assert result4 in ( 583 'http://sample.com/index?a=2&b=3', 584 'http://sample.com/index?b=3&a=2')
Note: See TracChangeset for help on using the changeset viewer.