summaryrefslogtreecommitdiffstats
path: root/testapi/testapi-client/testapiclient/cli
diff options
context:
space:
mode:
authorSerenaFeng <feng.xiaowei@zte.com.cn>2018-03-14 16:17:34 +0800
committerSerenaFeng <feng.xiaowei@zte.com.cn>2018-03-14 16:17:34 +0800
commitc761a572ae14368ad002a911d07d14c5c5c1b703 (patch)
tree67b7fc1d45540f869f955c63e6a097443e2b97c3 /testapi/testapi-client/testapiclient/cli
parent0e0e2702eeeb824f57599c536ae1534c5b0668f7 (diff)
bugfix: TestAPI Cookie cannot be found
Change-Id: Ibab60aba26e30669dddab74ce61ed00197dc86a8 Signed-off-by: SerenaFeng <feng.xiaowei@zte.com.cn>
Diffstat (limited to 'testapi/testapi-client/testapiclient/cli')
-rw-r--r--testapi/testapi-client/testapiclient/cli/auth.py14
-rw-r--r--testapi/testapi-client/testapiclient/cli/pods.py21
-rw-r--r--testapi/testapi-client/testapiclient/cli/projects.py24
3 files changed, 21 insertions, 38 deletions
diff --git a/testapi/testapi-client/testapiclient/cli/auth.py b/testapi/testapi-client/testapiclient/cli/auth.py
deleted file mode 100644
index 434c55a..0000000
--- a/testapi/testapi-client/testapiclient/cli/auth.py
+++ /dev/null
@@ -1,14 +0,0 @@
-from testapiclient.utils import command
-from testapiclient.utils import identity
-
-
-class Auth(command.Command):
- "Handle Authentication for users"
-
- def get_parser(self, prog_name):
- parser = super(Auth, self).get_parser(prog_name)
- return parser
-
- @identity.authenticate
- def take_action(self, parsed_args):
- print "Authentication has been successful!"
diff --git a/testapi/testapi-client/testapiclient/cli/pods.py b/testapi/testapi-client/testapiclient/cli/pods.py
index 9cadee7..8d0970b 100644
--- a/testapi/testapi-client/testapiclient/cli/pods.py
+++ b/testapi/testapi-client/testapiclient/cli/pods.py
@@ -1,17 +1,15 @@
import json
from testapiclient.utils import command
-from testapiclient.utils import http_client as client
-from testapiclient.utils import identity
-from testapiclient.utils import url_parse as up
+from testapiclient.utils import urlparse
def pods_url():
- return up.resource_join('pods')
+ return urlparse.resource_join('pods')
def pod_url(parsed_args):
- return up.path_join(pods_url(), parsed_args.name)
+ return urlparse.path_join(pods_url(), parsed_args.name)
class PodGet(command.Lister):
@@ -34,7 +32,8 @@ class PodGet(command.Lister):
"creation_date",
)
- data = client.get(up.query_by(pods_url(), 'name', parsed_args))
+ data = self.app.client_manager.get(
+ urlparse.query_by(pods_url(), 'name', parsed_args))
return self.format_output(columns, data.get('pods', []))
@@ -49,7 +48,8 @@ class PodGetOne(command.ShowOne):
return parser
def take_action(self, parsed_args):
- return self.format_output(client.get(pod_url(parsed_args)))
+ return self.format_output(
+ self.app.client_manager.get(pod_url(parsed_args)))
class PodCreate(command.ShowOne):
@@ -66,9 +66,9 @@ class PodCreate(command.ShowOne):
'mode should be either "metal" or "virtual.')
return parser
- @identity.authenticate
def take_action(self, parsed_args):
- return self.format_output(client.post(pods_url(), parsed_args.pod))
+ return self.format_output(
+ self.app.client_manager.post(pods_url(), parsed_args.pod))
class PodDelete(command.Command):
@@ -81,6 +81,5 @@ class PodDelete(command.Command):
help='Delete pods using name')
return parser
- @identity.authenticate
def take_action(self, parsed_args):
- return client.delete(pod_url(parsed_args))
+ return self.app.client_manager.delete(pod_url(parsed_args))
diff --git a/testapi/testapi-client/testapiclient/cli/projects.py b/testapi/testapi-client/testapiclient/cli/projects.py
index 718623a..510acc8 100644
--- a/testapi/testapi-client/testapiclient/cli/projects.py
+++ b/testapi/testapi-client/testapiclient/cli/projects.py
@@ -1,17 +1,15 @@
import json
from testapiclient.utils import command
-from testapiclient.utils import http_client as client
-from testapiclient.utils import identity
-from testapiclient.utils import url_parse as up
+from testapiclient.utils import urlparse
def projects_url():
- return up.resource_join('projects')
+ return urlparse.resource_join('projects')
def project_url(parsed_args):
- return up.path_join(projects_url(), parsed_args.name)
+ return urlparse.path_join(projects_url(), parsed_args.name)
class ProjectGet(command.Lister):
@@ -29,7 +27,8 @@ class ProjectGet(command.Lister):
'creator',
'creation_date'
)
- data = client.get(up.query_by(projects_url(), 'name', parsed_args))
+ data = self.app.client_manager.get(
+ urlparse.query_by(projects_url(), 'name', parsed_args))
return self.format_output(columns, data.get('projects', []))
@@ -42,7 +41,8 @@ class ProjectGetOne(command.ShowOne):
return parser
def take_action(self, parsed_args):
- return self.format_output(client.get(project_url(parsed_args)))
+ return self.format_output(
+ self.app.client_manager.get(project_url(parsed_args)))
class ProjectCreate(command.ShowOne):
@@ -56,10 +56,9 @@ class ProjectCreate(command.ShowOne):
'"description": (optional)""}')
return parser
- @identity.authenticate
def take_action(self, parsed_args):
return self.format_output(
- client.post(projects_url(), parsed_args.project))
+ self.app.client_manager.post(projects_url(), parsed_args.project))
class ProjectDelete(command.Command):
@@ -71,9 +70,8 @@ class ProjectDelete(command.Command):
help='Delete project by name')
return parser
- @identity.authenticate
def take_action(self, parsed_args):
- return client.delete(project_url(parsed_args))
+ return self.app.client_manager.delete(project_url(parsed_args))
class ProjectPut(command.ShowOne):
@@ -90,7 +88,7 @@ class ProjectPut(command.ShowOne):
'"description": (optional)""}')
return parser
- @identity.authenticate
def take_action(self, parsed_args):
return self.format_output(
- client.put(project_url(parsed_args), parsed_args.project))
+ self.app.client_manager.put(
+ project_url(parsed_args), parsed_args.project))