From 95ff5d69c63f0958d60dbdfd834abe15e545fae5 Mon Sep 17 00:00:00 2001 From: thuva4 Date: Tue, 8 May 2018 22:35:50 +0530 Subject: Add project client Tests added Doc added Change-Id: I4c6be343606fd3b171ae76e8fb97aaf084bc376d Signed-off-by: thuva4 --- .../developer/devguide/testapi-client-import.rst | 123 ++++++++++++++++++++- 1 file changed, 118 insertions(+), 5 deletions(-) (limited to 'testapi/docs/developer/devguide/testapi-client-import.rst') diff --git a/testapi/docs/developer/devguide/testapi-client-import.rst b/testapi/docs/developer/devguide/testapi-client-import.rst index 69cb6ad..ad41029 100644 --- a/testapi/docs/developer/devguide/testapi-client-import.rst +++ b/testapi/docs/developer/devguide/testapi-client-import.rst @@ -21,7 +21,7 @@ Pod GET """ -User will get the json Pod objects with the get request. +Get a list of all the declared pods from the TestAPI server. .. code-block:: shell @@ -30,7 +30,9 @@ User will get the json Pod objects with the get request. pod_client = pods.PodsClient() pod_client.get() -User can use search parameters to get pods +The user can filter the results by the name attribute. Backend will +use a regular expression to find the list of pods which are +related to given name. .. code-block:: shell @@ -39,10 +41,15 @@ User can use search parameters to get pods pod_client = pods.PodsClient() pod_client.get(name='pod1') +.. NOTE:: + Response format: [{"_id": "", "creator": "", "role": "", "name": "", + "details": "", "mode": "", "creation_date": ""}] + + GET ONE """"""" -User will get the json Pod objects with the get request. +Get a specific pod by its name. .. code-block:: shell @@ -51,9 +58,25 @@ User will get the json Pod objects with the get request. pod_client = pods.PodsClient() pod_client.get_one('name') +.. NOTE:: + Response format: {"_id": "", "creator": "", "role": "", "name": "", + "details": "", "mode": "", "creation_date": ""} + CREATE """""" -User has to authenticate before running the function. +This method used to create a project on the server. +The user should provide the user parameter and the password +parameter while initiating the PodsClient. + +Input for the function : + + * pod-json : Json object of the project + +.. NOTE:: + pod-json-schema - '{"role": "", "name": "", "details": "", "mode": ""}' + + * role should be either "community-ci" or "production-ci" + * mode should be either "metal" or "virtual" .. code-block:: shell @@ -61,5 +84,95 @@ User has to authenticate before running the function. pod_client = pods.PodsClient(user='test', password='pass') pod_client.create({'name': 'test-api', 'mode':'metal', - 'role':'community_ci', 'details':''} + 'role':'community_ci', 'details':''}) + + +Project +^^^^^^^ + +GET +""" + +Get a list of all the declared projects from the TestAPI server. + +.. code-block:: shell + + from testapiclient.client import projects + + project_client = projects.ProjectsClient() + project_client.get() + +User can filter the results by the name attribute. Backend will +use a regular expression to find the list of projects which are +related to given name. + +.. code-block:: shell + + from testapiclient.client import projects + + project_client = projects.ProjectsClient() + project_client.get(name='project1') + +.. NOTE:: + Response format: [{"_id": "", "creator": "", "description": "", + "name": "", "creation_date": ""}] + +GET ONE +""""""" + +Get a specific project by its name. + +.. code-block:: shell + + from testapiclient.client import projects + + project_client = projects.ProjectsClient() + project_client.get_one('name') + +.. NOTE:: + Response format: {"_id": "", "creator": "", "description": "", + "name": "", "creation_date": ""} + +CREATE +"""""" + +This method used to create a project on the server. +The user should provide the user parameter and the password +parameter while initiating the ProjectsClient. + +Input for the function : + + * project-json : Json object of the project + +.. NOTE:: + project-json schema - '{"description": "", "name": ""}' + +.. code-block:: shell + + from testapiclient.client import projects + + project_client = projects.ProjectsClient(user='test', password='pass') + project_client.create({'name': 'functest', 'description':'sample text'} + +UPDATE +"""""" + +This method used to update an existing project on the server. +The user should provide the user parameter and the password +parameter while initiating the ProjectsClient. + +Input for the function : + + * project-name: name of the project which user want to update. + * project-json: Json object of the project + +.. NOTE:: + project-json schema - '{"description": "", "name": ""}' + +.. code-block:: shell + + from testapiclient.client import projects + project_client = projects.ProjectsClient(user='test', password='pass') + project_client.update('functest', {'name': 'functest', + 'description':'updated text'}) \ No newline at end of file -- cgit 1.2.3-korg