Skip to content

Commit

Permalink
Some server test python3 updates
Browse files Browse the repository at this point in the history
  • Loading branch information
nyalldawson committed Sep 20, 2016
1 parent 05885fa commit 4ad5038
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
4 changes: 2 additions & 2 deletions tests/src/python/qgis_local_server.py
Original file line number Diff line number Diff line change
Expand Up @@ -425,7 +425,7 @@ def get_capabilities(self, params, browser=False):
url = self._fcgi_url + '?' + self.process_params(params)

res = urllib.request.urlopen(url)
xml = res.read()
xml = res.read().decode('utf-8')
if browser:
tmp_name = getTempfilePath('html')
with open(tmp_name, 'wt') as temp_html:
Expand Down Expand Up @@ -732,7 +732,7 @@ def tearDown(self):
# print repr(res)
assert (res is not None
and res.getcode() == 200
and 'Web Server Working' in res.read()), msg
and 'Web Server Working' in res.read().decode('utf-8')), msg

# verify basic wms service
params = {
Expand Down
7 changes: 5 additions & 2 deletions tests/src/python/test_qgsserver.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
import urllib.request
import urllib.parse
import urllib.error
from mimetools import Message
import email
from io import StringIO
from qgis.server import QgsServer
from qgis.core import QgsMessageLog
Expand All @@ -45,7 +45,10 @@ def setUp(self):
self.server = QgsServer()

def assert_headers(self, header, body):
headers = Message(StringIO(header))
stream = StringIO()
header_string = header.decode('utf-8')
stream.write(header_string)
headers = email.message_from_string(header_string)
if 'content-length' in headers:
content_length = int(headers['content-length'])
body_length = len(body)
Expand Down

0 comments on commit 4ad5038

Please sign in to comment.