diff options
author | 2017-01-17 14:55:02 +0800 | |
---|---|---|
committer | 2017-01-18 17:52:54 +0800 | |
commit | 8ce27ce11a5916d9b725ff74be304805c0c3ebe7 (patch) | |
tree | 26e08633e30baae180fca2b5e658c952acc35551 /utils/test/testapi/opnfv_testapi/tests/unit/test_base.py | |
parent | a83e598c5401531d8f4010f16a7c41461fa4e828 (diff) |
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 <feng.xiaowei@zte.com.cn>
Diffstat (limited to 'utils/test/testapi/opnfv_testapi/tests/unit/test_base.py')
-rw-r--r-- | utils/test/testapi/opnfv_testapi/tests/unit/test_base.py | 8 |
1 files changed, 4 insertions, 4 deletions
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) |