tests: remove usage of urllib2 (#36515)
This commit is contained in:
parent
75516f7b6a
commit
d33ae185a7
|
@ -4,7 +4,6 @@ import os
|
|||
import pytest
|
||||
import shutil
|
||||
import time
|
||||
import urllib2
|
||||
import zipfile
|
||||
|
||||
import mock
|
||||
|
@ -2710,7 +2709,7 @@ def test_geolocate_address(pub):
|
|||
json.dumps([{'lat':'48.8337085','lon':'2.3233693'}]), None)
|
||||
item.perform(formdata)
|
||||
assert 'https://nominatim.entrouvert.org/search' in http_get_page.call_args[0][0]
|
||||
assert urllib2.quote('169 rue du chateau, paris') in http_get_page.call_args[0][0]
|
||||
assert urlparse.quote('169 rue du chateau, paris') in http_get_page.call_args[0][0]
|
||||
assert int(formdata.geolocations['base']['lat']) == 48
|
||||
assert int(formdata.geolocations['base']['lon']) == 2
|
||||
|
||||
|
@ -2721,7 +2720,7 @@ def test_geolocate_address(pub):
|
|||
json.dumps([{'lat':'48.8337085', 'lon':'2.3233693'}]), None)
|
||||
item.perform(formdata)
|
||||
assert 'https://nominatim.entrouvert.org/search' in http_get_page.call_args[0][0]
|
||||
assert urllib2.quote('169 rue du chateau, paris') in http_get_page.call_args[0][0]
|
||||
assert urlparse.quote('169 rue du chateau, paris') in http_get_page.call_args[0][0]
|
||||
assert 'key=KEY' in http_get_page.call_args[0][0]
|
||||
assert int(formdata.geolocations['base']['lat']) == 48
|
||||
assert int(formdata.geolocations['base']['lon']) == 2
|
||||
|
|
|
@ -21,12 +21,11 @@ import os
|
|||
import random
|
||||
import sys
|
||||
import tempfile
|
||||
import urllib2
|
||||
import urlparse
|
||||
import hashlib
|
||||
|
||||
from django.utils.encoding import force_text
|
||||
from django.utils.six.moves import configparser as ConfigParser
|
||||
from django.utils.six.moves.urllib import parse as urlparse
|
||||
|
||||
from quixote import cleanup
|
||||
from ..qommon import misc
|
||||
|
@ -350,7 +349,7 @@ class CmdCheckHobos(Command):
|
|||
pub.write_cfg()
|
||||
|
||||
def get_instance_path(self, service):
|
||||
parsed_url = urllib2.urlparse.urlsplit(service.get('base_url'))
|
||||
parsed_url = urlparse.urlsplit(service.get('base_url'))
|
||||
instance_path = parsed_url.netloc
|
||||
if parsed_url.path:
|
||||
instance_path += '+%s' % parsed_url.path.replace('/', '+')
|
||||
|
|
|
@ -16,7 +16,6 @@
|
|||
|
||||
import collections
|
||||
import json
|
||||
import urllib2
|
||||
|
||||
try:
|
||||
from PIL import Image
|
||||
|
@ -24,6 +23,7 @@ try:
|
|||
except ImportError:
|
||||
Image = None
|
||||
|
||||
from django.utils.six.moves.urllib import parse as urlparse
|
||||
from quixote import get_publisher
|
||||
|
||||
from ..qommon import _
|
||||
|
@ -121,7 +121,7 @@ class GeolocateWorkflowStatusItem(WorkflowStatusItem):
|
|||
url += '&'
|
||||
else:
|
||||
url += '?'
|
||||
url += 'q=%s' % urllib2.quote(address)
|
||||
url += 'q=%s' % urlparse.quote(address)
|
||||
url += '&format=json'
|
||||
url += '&accept-language=%s' % (get_publisher().get_site_language() or 'en')
|
||||
|
||||
|
|
Loading…
Reference in New Issue