diff options
author | thuva4 <tharma.thuva@gmail.com> | 2018-04-26 13:15:03 +0530 |
---|---|---|
committer | thuva4 <tharma.thuva@gmail.com> | 2018-05-07 11:43:54 +0530 |
commit | d7b3e7b890fa21a018900e459c8b85e7a8f68332 (patch) | |
tree | c059fedee7bb50345f3a2e5a93c401b97245f3ae /testapi/testapi-client/testapiclient/client | |
parent | 71c429c25f30660d436fef7b064553c266d4655a (diff) |
Add get functionality for the import module
Tested
Module will deserialize the json objects from the server to Pod
instance.
Change-Id: I3e2cb9386f8949d544624be687ee227ae4529d72
Signed-off-by: thuva4 <tharma.thuva@gmail.com>
Diffstat (limited to 'testapi/testapi-client/testapiclient/client')
-rw-r--r-- | testapi/testapi-client/testapiclient/client/pods.py | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/testapi/testapi-client/testapiclient/client/pods.py b/testapi/testapi-client/testapiclient/client/pods.py index 4254da7..d08114f 100644 --- a/testapi/testapi-client/testapiclient/client/pods.py +++ b/testapi/testapi-client/testapiclient/client/pods.py @@ -1,4 +1,7 @@ +import json + from testapiclient.client import base +from testapiclient.utils import urlparse class PodsClient(base.Client): @@ -9,3 +12,20 @@ class PodsClient(base.Client): def create(self, pod_req): return self.clientmanager.post(self.url, pod_req) + + def get(self, **queries): + if queries: + return json.dumps( + self.clientmanager.get( + urlparse.query_join(self.url, **queries))['pods']) + else: + return json.dumps( + self.clientmanager.get(self.url)['pods']) + + def get_one(self, name): + return json.dumps(self.clientmanager.get( + urlparse.path_join(self.url, name))) + + def delete(self, name): + return self.clientmanager.delete( + urlparse.path_join(self.url, name)) |