Use six.moves.urllib for python3 compat

The urllib2 module has been split across several modules in Python3
named urllib.request and urllib.error.

Change-Id: Ie13cfe8caebdfd236556dcb08396bf5e7e6debc7
Signed-off-by: Paul Belanger <pabelanger@redhat.com>
This commit is contained in:
Paul Belanger 2017-05-09 12:08:52 -04:00
parent 8e1c94abc6
commit 28bc25c30f
No known key found for this signature in database
GPG Key ID: 611A80832067AF38
1 changed files with 5 additions and 5 deletions

View File

@ -15,7 +15,7 @@
import json
import logging
import urllib2
from six.moves.urllib import request
from nodepool import tests
@ -35,9 +35,9 @@ class TestWebApp(tests.DBTestCase):
self.waitForImage('fake-provider', 'fake-image')
self.waitForNodes('fake-label')
req = urllib2.Request(
req = request.Request(
"http://localhost:%s/image-list" % port)
f = urllib2.urlopen(req)
f = request.urlopen(req)
self.assertEqual(f.info().getheader('Content-Type'),
'text/plain; charset=UTF-8')
data = f.read()
@ -55,9 +55,9 @@ class TestWebApp(tests.DBTestCase):
self.waitForImage('fake-provider', 'fake-image')
self.waitForNodes('fake-label')
req = urllib2.Request(
req = request.Request(
"http://localhost:%s/dib-image-list.json" % port)
f = urllib2.urlopen(req)
f = request.urlopen(req)
self.assertEqual(f.info().getheader('Content-Type'),
'application/json')
data = f.read()