diff options
author | thuva4 <tharma.thuva@gmail.com> | 2018-05-08 22:59:14 +0530 |
---|---|---|
committer | thuva4 <tharma.thuva@gmail.com> | 2018-05-08 22:59:14 +0530 |
commit | e3f3db9b7c118b37f94d528f8e3e91c34716fa42 (patch) | |
tree | 8623879cf4476c8fa073ad63cf511015580b3b7d /testapi/testapi-client/testapiclient/client | |
parent | e4c1d703a7784fe8acea8477fc57fb2438201c33 (diff) |
Add testcase client
Change-Id: I75825642f21ab0818f5c08e6be2510f36cdadb19
Signed-off-by: thuva4 <tharma.thuva@gmail.com>
Diffstat (limited to 'testapi/testapi-client/testapiclient/client')
-rw-r--r-- | testapi/testapi-client/testapiclient/client/testcases.py | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/testapi/testapi-client/testapiclient/client/testcases.py b/testapi/testapi-client/testapiclient/client/testcases.py new file mode 100644 index 0000000..bb2b6d3 --- /dev/null +++ b/testapi/testapi-client/testapiclient/client/testcases.py @@ -0,0 +1,36 @@ +import json + +from testapiclient.client import base +from testapiclient.utils import urlparse + + +class TestcasesClient(base.Client): + resource = 'projects/{}/cases' + + def __init__(self, **kwargs): + super(TestcasesClient, self).__init__(**kwargs) + + def create(self, project_name, testcase_req): + return self.clientmanager.post( + self.url.format(project_name), testcase_req) + + def get(self, project_name): + return json.dumps( + self.clientmanager.get( + self.url.format(project_name))['testcases']) + + def get_one(self, project_name, name): + return json.dumps( + self.clientmanager.get( + urlparse.path_join( + self.url.format(project_name), name))) + + def delete(self, project_name, name): + return self.clientmanager.delete( + urlparse.path_join( + self.url.format(project_name), name)) + + def update(self, project_name, name, testcase_req): + return self.clientmanager.put( + urlparse.path_join( + self.url.format(project_name), name), testcase_req) |