Skip to content
This repository was archived by the owner on Jan 18, 2025. It is now read-only.

Commit ed36586

Browse files
committed
tests: use six.moves.urllib for py2/3 compatibility
1 parent 3689e0a commit ed36586

1 file changed

Lines changed: 7 additions & 7 deletions

File tree

tests/test_appengine.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,8 @@
2828
import os
2929
import time
3030
import unittest
31-
import urllib
32-
import urlparse
31+
32+
from six.moves import urllib
3333

3434
import dev_appserver
3535
dev_appserver.fix_sys_path()
@@ -550,7 +550,7 @@ def test_required(self):
550550
self.assertEqual(self.decorator.credentials, None)
551551
response = self.app.get('http://localhost/foo_path')
552552
self.assertTrue(response.status.startswith('302'))
553-
q = urlparse.parse_qs(response.headers['Location'].split('?', 1)[1])
553+
q = urllib.parse.parse_qs(response.headers['Location'].split('?', 1)[1])
554554
self.assertEqual('http://localhost/oauth2callback', q['redirect_uri'][0])
555555
self.assertEqual('foo_client_id', q['client_id'][0])
556556
self.assertEqual('foo_scope bar_scope', q['scope'][0])
@@ -571,10 +571,10 @@ def test_required(self):
571571
self.assertEqual('http://localhost/foo_path', parts[0])
572572
self.assertEqual(None, self.decorator.credentials)
573573
if self.decorator._token_response_param:
574-
response_query = urlparse.parse_qs(parts[1])
574+
response_query = urllib.parse.parse_qs(parts[1])
575575
response = response_query[self.decorator._token_response_param][0]
576576
self.assertEqual(Http2Mock.content,
577-
json.loads(urllib.unquote(response)))
577+
json.loads(urllib.parse.unquote(response)))
578578
self.assertEqual(self.decorator.flow, self.decorator._tls.flow)
579579
self.assertEqual(self.decorator.credentials,
580580
self.decorator._tls.credentials)
@@ -605,7 +605,7 @@ def test_required(self):
605605
# Invalid Credentials should start the OAuth dance again.
606606
response = self.app.get('/foo_path')
607607
self.assertTrue(response.status.startswith('302'))
608-
q = urlparse.parse_qs(response.headers['Location'].split('?', 1)[1])
608+
q = urllib.parse.parse_qs(response.headers['Location'].split('?', 1)[1])
609609
self.assertEqual('http://localhost/oauth2callback', q['redirect_uri'][0])
610610

611611
def test_storage_delete(self):
@@ -650,7 +650,7 @@ def test_aware(self):
650650
self.assertEqual('200 OK', response.status)
651651
self.assertEqual(False, self.decorator.has_credentials())
652652
url = self.decorator.authorize_url()
653-
q = urlparse.parse_qs(url.split('?', 1)[1])
653+
q = urllib.parse.parse_qs(url.split('?', 1)[1])
654654
self.assertEqual('http://localhost/oauth2callback', q['redirect_uri'][0])
655655
self.assertEqual('foo_client_id', q['client_id'][0])
656656
self.assertEqual('foo_scope bar_scope', q['scope'][0])

0 commit comments

Comments
 (0)