From 8ce27ce11a5916d9b725ff74be304805c0c3ebe7 Mon Sep 17 00:00:00 2001 From: SerenaFeng Date: Tue, 17 Jan 2017 14:55:02 +0800 Subject: implement get/query scenario(s) and add unittest supported queries: scenario name/version/installer/project JIRA: RELENG-163 Change-Id: I3f6ea6e3c81edff30569918e0789e8c1e693b9fc Signed-off-by: SerenaFeng --- utils/test/testapi/opnfv_testapi/tests/unit/test_base.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'utils/test/testapi/opnfv_testapi/tests/unit/test_base.py') diff --git a/utils/test/testapi/opnfv_testapi/tests/unit/test_base.py b/utils/test/testapi/opnfv_testapi/tests/unit/test_base.py index 9343ab2fb..fc780e44c 100644 --- a/utils/test/testapi/opnfv_testapi/tests/unit/test_base.py +++ b/utils/test/testapi/opnfv_testapi/tests/unit/test_base.py @@ -47,11 +47,11 @@ class TestBase(AsyncHTTPTestCase): return self.create_help(self.basePath, req, *args) def create_help(self, uri, req, *args): - if req and not isinstance(req, str): - req = json.dumps(req.format()) + if req and not isinstance(req, str) and hasattr(req, 'format'): + req = req.format() res = self.fetch(self._update_uri(uri, *args), method='POST', - body=req if req else json.dumps(None), + body=json.dumps(req), headers=self.headers) return self._get_return(res, self.create_res) @@ -97,7 +97,7 @@ class TestBase(AsyncHTTPTestCase): return uri.count('%s') def _get_query_uri(self, query): - return self.basePath + '?' + query + return self.basePath + '?' + query if query else self.basePath def _get_uri(self, *args): return self._update_uri(self.basePath, *args) -- cgit 1.2.3-korg