From d7b3e7b890fa21a018900e459c8b85e7a8f68332 Mon Sep 17 00:00:00 2001 From: thuva4 Date: Thu, 26 Apr 2018 13:15:03 +0530 Subject: 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 --- testapi/testapi-client/testapiclient/client/pods.py | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) (limited to 'testapi/testapi-client/testapiclient/client') 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)) -- cgit 1.2.3-korg