diff options
author | SerenaFeng <feng.xiaowei@zte.com.cn> | 2018-03-09 15:53:12 +0800 |
---|---|---|
committer | SerenaFeng <feng.xiaowei@zte.com.cn> | 2018-03-09 16:18:25 +0800 |
commit | cc29ae1cd41d1f403511730d5ba44dded967fb12 (patch) | |
tree | 6a0f09182398f7e4fe3cbabd199f30937f0ede0a /testapi/testapi-client/testapiclient/projects.py | |
parent | c9d24c5253c0ba3e09151c880cdb8c16e145ea60 (diff) |
unify message prompt
Change-Id: I31a10c0aa92a72fdbd76475e6f618f63fef9b925
Signed-off-by: SerenaFeng <feng.xiaowei@zte.com.cn>
Diffstat (limited to 'testapi/testapi-client/testapiclient/projects.py')
-rw-r--r-- | testapi/testapi-client/testapiclient/projects.py | 25 |
1 files changed, 9 insertions, 16 deletions
diff --git a/testapi/testapi-client/testapiclient/projects.py b/testapi/testapi-client/testapiclient/projects.py index ad42293..7f98b56 100644 --- a/testapi/testapi-client/testapiclient/projects.py +++ b/testapi/testapi-client/testapiclient/projects.py @@ -1,7 +1,7 @@ import json from testapiclient import command -from testapiclient import http_client +from testapiclient import http_client as client from testapiclient import identity from testapiclient import url_parse @@ -24,9 +24,7 @@ class ProjectGet(command.Lister): return parser def take_action(self, parsed_args): - projects = http_client.get(self.filter_name(projects_url(), - parsed_args)) - print projects + self.show(client.get(self.filter_name(projects_url(), parsed_args))) class ProjectGetOne(command.ShowOne): @@ -40,8 +38,7 @@ class ProjectGetOne(command.ShowOne): return parser def take_action(self, parsed_args): - project = http_client.get(project_url(parsed_args)) - print project + self.show(client.get(project_url(parsed_args))) class ProjectCreate(command.Command): @@ -57,11 +54,8 @@ class ProjectCreate(command.Command): @identity.authenticate def take_action(self, parsed_args): - response = http_client.post(projects_url(), parsed_args.project) - if response.status_code == 200: - print "Project has been successfully created!" - else: - print response.text + self.show('Create', + client.post(projects_url(), parsed_args.project)) class ProjectDelete(command.Command): @@ -76,8 +70,8 @@ class ProjectDelete(command.Command): @identity.authenticate def take_action(self, parsed_args): - projects = http_client.delete(project_url(parsed_args)) - print projects + self.show('Delete', + client.delete(project_url(parsed_args))) class ProjectPut(command.Command): @@ -97,6 +91,5 @@ class ProjectPut(command.Command): @identity.authenticate def take_action(self, parsed_args): - projects = http_client.put(project_url(parsed_args), - parsed_args.project) - print projects + self.show('Update', + client.put(project_url(parsed_args), parsed_args.project)) |