diff options
Diffstat (limited to 'testapi/testapi-client/testapiclient/projects.py')
-rw-r--r-- | testapi/testapi-client/testapiclient/projects.py | 37 |
1 files changed, 18 insertions, 19 deletions
diff --git a/testapi/testapi-client/testapiclient/projects.py b/testapi/testapi-client/testapiclient/projects.py index 2e61369..cd55e74 100644 --- a/testapi/testapi-client/testapiclient/projects.py +++ b/testapi/testapi-client/testapiclient/projects.py @@ -1,13 +1,12 @@ import json from testapiclient import command +from testapiclient import config +from testapiclient import httpClient from testapiclient import identity +from testapiclient import user -from config import Config -from httpClient import HTTPClient -from user import User - -PROJECTS_URL = Config.config.get("api", "url") + "/projects" +PROJECTS_URL = config.Config.config.get("api", "url") + "/projects" class ProjectGet(command.Lister): @@ -20,11 +19,11 @@ class ProjectGet(command.Lister): return parser def take_action(self, parsed_args): - httpClient = HTTPClient.get_Instance() + http_client = httpClient.HTTPClient.get_Instance() url = PROJECTS_URL if parsed_args.name: url = url + "?name=" + parsed_args.name - projects = httpClient.get(url) + projects = http_client.get(url) print projects @@ -39,9 +38,9 @@ class ProjectGetOne(command.ShowOne): return parser def take_action(self, parsed_args): - httpClient = HTTPClient.get_Instance() + http_client = httpClient.HTTPClient.get_Instance() url = PROJECTS_URL + "/" + parsed_args.name - project = httpClient.get(url) + project = http_client.get(url) print project @@ -58,10 +57,10 @@ class ProjectCreate(command.Command): @identity.authenticate def take_action(self, parsed_args): - httpClient = HTTPClient.get_Instance() - response = httpClient.post(ProjectCreate.projects_url, - User.session, - parsed_args.project) + http_client = httpClient.HTTPClient.get_Instance() + response = http_client.post(ProjectCreate.projects_url, + user.User.session, + parsed_args.project) if response.status_code == 200: print "Project has been successfully created!" else: @@ -80,10 +79,10 @@ class ProjectDelete(command.Command): @identity.authenticate def take_action(self, parsed_args): - httpClient = HTTPClient.get_Instance() - projects = httpClient.delete( + http_client = httpClient.HTTPClient.get_Instance() + projects = http_client.delete( PROJECTS_URL + "/" + parsed_args.name, - User.session) + user.User.session) print projects @@ -104,9 +103,9 @@ class ProjectPut(command.Command): @identity.authenticate def take_action(self, parsed_args): - httpClient = HTTPClient.get_Instance() - projects = httpClient.put( + http_client = httpClient.HTTPClient.get_Instance() + projects = http_client.put( PROJECTS_URL + "/" + parsed_args.name, - User.session, + user.User.session, parsed_args.project) print projects |