1
1
# -*- coding: utf-8 -*-
2
2
"""QGIS Unit tests for QgsServer.
3
3
4
- Set the env var NO_ENCODED_OUTPUT to disable printing the base64 encoded image diff
4
+ Set the env var ENCODED_OUTPUT to enable printing the base64 encoded image diff
5
5
6
6
FIXME: keep here only generic server tests and move specific services
7
7
tests to test_qgsserver_<service>.py
@@ -191,7 +191,7 @@ def _img_diff_error(self, response, headers, image, max_diff=100, max_size_diff=
191
191
192
192
with open (os .path .join (tempfile .gettempdir (), image + "_result.png" ), "rb" ) as rendered_file :
193
193
encoded_rendered_file = base64 .b64encode (rendered_file .read ())
194
- if os .environ .get ('NO_ENCODED_OUTPUT ' ):
194
+ if not os .environ .get ('ENCODED_OUTPUT ' ):
195
195
message = "Image is wrong\: rendered file %s/%s_result.png" % (tempfile .gettempdir (), image )
196
196
else :
197
197
message = "Image is wrong\n %s\n Image:\n echo '%s' | base64 -d >%s/%s_result.png" % (
@@ -201,7 +201,7 @@ def _img_diff_error(self, response, headers, image, max_diff=100, max_size_diff=
201
201
# If the failure is in image sizes the diff file will not exists.
202
202
if os .path .exists (os .path .join (tempfile .gettempdir (), image + "_result_diff.png" )):
203
203
with open (os .path .join (tempfile .gettempdir (), image + "_result_diff.png" ), "rb" ) as diff_file :
204
- if os .environ .get ('NO_ENCODED_OUTPUT ' ):
204
+ if not os .environ .get ('ENCODED_OUTPUT ' ):
205
205
message = "Image is wrong\: diff file %s/%s_result_diff.png" % (tempfile .gettempdir (), image )
206
206
else :
207
207
encoded_diff_file = base64 .b64encode (diff_file .read ())
0 commit comments