From ced96cc6f76ec9c5e96594bdb8659cbda4434aa2 Mon Sep 17 00:00:00 2001 From: Wannes Rombouts <wapiflapi@yahoo.fr> Date: Wed, 5 Jun 2013 10:32:26 +0200 Subject: [PATCH] Added default_encoding to tests, so that we can switch json/xml easy. --- tests/testScenario.py | 3 +++ tests/utils.py | 4 +++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/tests/testScenario.py b/tests/testScenario.py index 1fc4cd4..98a3a54 100644 --- a/tests/testScenario.py +++ b/tests/testScenario.py @@ -24,6 +24,7 @@ # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # +import utils from utils import APIRequest import sys @@ -358,6 +359,8 @@ def _test_layers(target, map_name): def test_scenario(): + # utils.default_encoding = "xml" + target = "http://localhost:8080" map_name = "tests" diff --git a/tests/utils.py b/tests/utils.py index 73e4491..d6d9250 100644 --- a/tests/utils.py +++ b/tests/utils.py @@ -31,6 +31,8 @@ import json import sys +default_encoding = "json" + def deduce_content_type(type): if type == "json": return "application/json" @@ -38,7 +40,7 @@ def deduce_content_type(type): return "application/xml" -def APIRequest(method, url, data=None, encode="json", decode="json", content_type=None, expected_type=None, +def APIRequest(method, url, data=None, encode=default_encoding, decode=default_encoding, content_type=None, expected_type=None, get_response=False): if encode == "json": -- GitLab