summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--testapi/docs/developer/devguide/testapi-client-import.rst798
-rw-r--r--testapi/testapi-client/testapiclient/client/scenarios.py11
2 files changed, 805 insertions, 4 deletions
diff --git a/testapi/docs/developer/devguide/testapi-client-import.rst b/testapi/docs/developer/devguide/testapi-client-import.rst
index ad41029..c6d7311 100644
--- a/testapi/docs/developer/devguide/testapi-client-import.rst
+++ b/testapi/docs/developer/devguide/testapi-client-import.rst
@@ -175,4 +175,800 @@ Input for the function :
project_client = projects.ProjectsClient(user='test', password='pass')
project_client.update('functest', {'name': 'functest',
- 'description':'updated text'}) \ No newline at end of file
+ 'description':'updated text'})
+
+DELETE
+""""""
+
+This method used to delete 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 delete.
+
+.. code-block:: shell
+
+ from testapiclient.client import projects
+
+ project_client = projects.ProjectsClient(user='test', password='pass')
+ project_client.delete('functest')
+
+
+Testcase
+^^^^^^^^
+
+GET
+"""
+
+Get a list of all the declared testcases under a project
+from the TestAPI server.
+
+Input for the function :
+
+ * project_name : Name of the project
+
+.. code-block:: shell
+
+ from testapiclient.client import testcases
+
+ testcase_client = testcases.TestcasesClient()
+ testcase_client.get(project_name='functest')
+
+
+.. NOTE::
+ Response format: [{ "project_name": "functest", "run": "",
+ "description": "", "tags": "", "creation_date": "",
+ "dependencies": "", "tier": "", "trust": "", "blocking": "",
+ "name": "", "ci_loop": "", "url": "", "version": "",
+ "criteria": "", "domains": "", "_id": "", "catalog_description": ""}]
+
+GET ONE
+"""""""
+
+Get a specific testcase by its name and project name.
+
+.. code-block:: shell
+
+ from testapiclient.client import testcases
+
+ testcase_client = testcases.TestcasesClient()
+ testcase_client.get_one(project_name='functest', case_name='name')
+
+.. NOTE::
+ Response format: { "project_name": "functest", "run": "",
+ "description": "", "tags": "", "creation_date": "",
+ "dependencies": "", "tier": "", "trust": "", "blocking": "",
+ "name": "", "ci_loop": "", "url": "", "version": "",
+ "criteria": "", "domains": "", "_id": "", "catalog_description": ""}
+
+CREATE
+""""""
+
+This method used to create a testcase on the server.
+The user should provide the user parameter and the password
+parameter while initiating the TestcasesClient.
+
+Input for the function :
+ * project_name : Project name
+ * testcase_json : Json object of the testcase
+
+.. NOTE::
+ testcase_json schema - '{ "run": "", "description": "", "tags": "",
+ "dependencies": "", "tier": "", "trust": "", "blocking": "",
+ "name": "", "ci_loop": "", "url": "", "version": "",
+ "criteria": "", "domains": "", "catalog_description": ""}'
+
+.. code-block:: shell
+
+ from testapiclient.client import testcases
+
+ testcase_client = testcases.TestcasesClient(user='test', password='pass')
+ testcase_client.create(project_name, testcase_json)
+
+UPDATE
+""""""
+
+This method used to update an existing testcase on the server.
+The user should provide the user parameter and the password
+parameter while initiating the TestcasesClient.
+
+Input for the function :
+ * project_name : Project name
+ * testcase_name: name of the testcase which user want to update.
+ * testcase_json: Json object of the testcase
+
+.. NOTE::
+ testcase-json schema - '{ "run": "", "description": "", "tags": "",
+ "dependencies": "", "tier": "", "trust": "", "blocking": "",
+ "name": "", "ci_loop": "", "url": "", "version": "",
+ "criteria": "", "domains": "", "catalog_description": ""}'
+
+.. code-block:: shell
+
+ from testapiclient.client import testcases
+
+ testcase_client = testcases.TestcasesClient(user='test', password='pass')
+ testcase_client.update(project_name, testcase_name, testcase_json)
+
+DELETE
+""""""
+
+This method used to delete an existing testcase on the server.
+The user should provide the user parameter and the password
+parameter while initiating the TestcasesClient.
+
+Input for the function :
+
+ * project_name: name of the project
+ * testcase_name: name of the testcase which user want to delete.
+
+.. code-block:: shell
+
+ from testapiclient.client import testcases
+
+ testcase_client = testcases.TestcasesClient(user='test', password='pass')
+ testcase_client.delete(project_name, testcase_name)
+
+
+Result
+^^^^^^^
+
+GET
+"""
+
+Get a list of all the declared results from the TestAPI server.
+
+.. code-block:: shell
+
+ from testapiclient.client import results
+
+ result_client = results.ResultsClient()
+ result_client.get()
+
+User can filter the results by using some attributes.
+
+.. NOTE::
+ List of search attributes.
+
+ * case : Search results using tesetcase
+ * build-tag : Search results using build tag
+ * from : Search results using from date
+ * last : Search results using last date
+ * scenario : Search results using scenario
+ * period : Search results using period
+ * project : Search results using project
+ * to : Search results using to
+ * version : Search results using version
+ * criteria : Search results using criteria
+ * installer : Search results using installer
+ * pod : Search results using pod
+ * page : Search results using page
+
+.. code-block:: shell
+
+ from testapiclient.client import results
+
+ result_client = results.ResultsClient()
+ result_client.get(pod='pod1', project='project1')
+
+
+.. NOTE::
+ Response format: [{ "project_name": "", "scenario": "",
+ "stop_date": "", "case_name": "", "build_tag": "",
+ "version": "", "pod_name": "", "criteria": "",
+ "installer": "", "start_date": "", "details": ""}]
+
+GET ONE
+"""""""
+
+Get a specific result by its id.
+
+.. code-block:: shell
+
+ from testapiclient.client import results
+
+ result_client = results.ResultsClient()
+ result_client.get_one(result_id)
+
+.. NOTE::
+ Response format: { "project_name": "", "scenario": "",
+ "stop_date": "", "case_name": "", "build_tag": "",
+ "version": "", "pod_name": "", "criteria": "",
+ "installer": "", "start_date": "", "details": ""}
+
+CREATE
+""""""
+
+This method used to create a result on the server.
+The user should provide a valid token to run this method.
+Read testapi-client.rst to more details.
+
+Input for the function :
+ * result_json : Json object of the result
+
+.. NOTE::
+ result_json schema - '{ "project_name": "", "scenario": "",
+ "stop_date": "", "case_name": "", "build_tag": "",
+ "version": "", "pod_name": "", "criteria": "",
+ "installer": "", "start_date": "", "details": ""}'
+
+.. code-block:: shell
+
+ from testapiclient.client import results
+
+ result_client = results.ResultsClient()
+ result_client.create(result_json)
+
+DeployResult
+^^^^^^^^^^^^
+
+GET
+"""
+
+Get a list of all the declared deploy results from the TestAPI server.
+
+.. code-block:: shell
+
+ from testapiclient.client import deploy_results
+
+ deploy_result_client = deploy_results.DeployResultsClient()
+ deploy_result_client.get()
+
+User can filter the deploy results by using some attributes.
+
+.. NOTE::
+ List of search attributes.
+
+ * job-name : Search results using job
+ * build_id : Search results using build id
+ * from : Search results using from date
+ * last : Search results using last date
+ * scenario : Search results using scenario
+ * period : Search results using period
+ * to : Search results using to
+ * version : Search results using version
+ * criteria : Search results using criteria
+ * installer : Search results using installer
+ * pod_name : Search results using pod
+ * page : Search results using page
+
+.. code-block:: shell
+
+ from testapiclient.client import deploy_results
+
+ deploy_result_client = deploy_results.DeployResultsClient()
+ deploy_result_client.get(scenario='scenario1', installer='installer1')
+
+
+.. NOTE::
+ Response format: [{"build_id": "", "upstream_build_id": "",
+ "scenario": "", "stop_date": "", "start_date": "",
+ "upstream_job_name": "", "version": "", "pod_name": "",
+ "criteria": "", "installer": "", "_id": "", "job_name": "",
+ "details": ""}]
+
+GET ONE
+"""""""
+
+Get a specific deploy result by its id.
+
+.. code-block:: shell
+
+ from testapiclient.client import deploy_results
+
+ deploy_result_client = deploy_results.DeployResultsClient()
+ deploy_result_client.get_one(deploy_result_id)
+
+.. NOTE::
+ Response format: {"build_id": "", "upstream_build_id": "",
+ "scenario": "", "stop_date": "", "start_date": "",
+ "upstream_job_name": "", "version": "", "pod_name": "",
+ "criteria": "", "installer": "", "_id": "", "job_name": "",
+ "details": ""}
+
+CREATE
+""""""
+
+This method used to create a deploy_result on the server.
+The user should provide a valid token to run this method.
+Read testapi-client.rst to more details.
+
+Input for the function :
+ * deploy_result_json : Json object of the deploy_result
+
+.. NOTE::
+ deploy_result_json schema - '{"build_id": "", "upstream_build_id": "",
+ "scenario": "", "stop_date": "", "start_date": "",
+ "upstream_job_name": "", "version": "", "pod_name": "",
+ "criteria": "", "installer": "", "job_name": "",
+ "details": ""}'
+
+.. code-block:: shell
+
+ from testapiclient.client import deploy_results
+
+ deploy_result_client = deploy_results.DeployResultsClient()
+ deploy_result_client.create(deploy_result_json)
+
+Scenario
+^^^^^^^^
+
+GET
+"""
+
+Get a list of all the declared scenarios from the TestAPI server.
+
+.. code-block:: shell
+
+ from testapiclient.client import scenarios
+
+ scenario_client = scenarios.ScenariosClient()
+ scenario_client.get()
+
+User can filter the scenarios by using some attributes.
+
+.. NOTE::
+ List of search attributes.
+
+ * project : Search scenarios using project
+ * installer : Search scenarios using project
+ * version : Search scenarios using project
+ * name: Search scenarios using project
+
+.. code-block:: shell
+
+ from testapiclient.client import scenarios
+
+ scenario_client = scenarios.ScenariosClient()
+ scenario_client.get(name='scenario1')
+
+.. NOTE::
+ Response format: [{ "installers": [], "_id": "", "creation_date": "",
+ "name": "", "creator": ""}]
+
+GET ONE
+"""""""
+
+Get a specific scenario by its name.
+
+.. code-block:: shell
+
+ from testapiclient.client import scenarios
+
+ scenario_client = scenarios.ScenariosClient()
+ scenario_client.get_one('name')
+
+.. NOTE::
+ Response format: { "installers": [], "_id": "", "creation_date": "",
+ "name": "", "creator": ""}
+
+CREATE
+""""""
+
+This method used to create a scenario on the server.
+The user should provide the user parameter and the password
+parameter while initiating the ScenariosClient.
+
+Input for the function :
+
+ * scenario-json : Json object of the scenario
+
+.. NOTE::
+ scenario_json schema - '{ "installers": [],
+ "name": ""}'
+
+ See Installer for installer_schema
+
+.. code-block:: shell
+
+ from testapiclient.client import scenarios
+
+ scenario_client = scenarios.ScenariosClient(user='test', password='pass')
+ scenario_client.create(scenario_json)
+
+UPDATE
+""""""
+
+This method used to update the name of an existing scenario on the server.
+The user should provide the user parameter and the password
+parameter while initiating the ScenariosClient.
+
+Input for the function :
+
+ * scenario-name: name of the scenario which user want to update.
+ * scenario-json: Json object of the scenario
+
+.. NOTE::
+ * scenario_name
+ * scenario_update_json schema - '{"name": ""}'
+
+.. code-block:: shell
+
+ from testapiclient.client import scenarios
+
+ scenario_client = scenarios.ScenariosClient(user='test', password='pass')
+ scenario_client.update(scenario_name, scenario_update_json)
+
+DELETE
+""""""
+
+This method used to delete an existing scenario on the server.
+The user should provide the user parameter and the password
+parameter while initiating the ScenariosClient.
+
+Input for the function :
+
+ * scenario_name: name of the scenario which user want to delete.
+
+.. code-block:: shell
+
+ from testapiclient.client import scenarios
+
+ scenario_client = scenarios.ScenariosClient(user='test', password='pass')
+ scenario_client.delete('scenario_name')
+
+Scenario Installer
+^^^^^^^^^^^^^^^^^^
+
+CREATE
+""""""
+
+This method used to create an installer under a scenario
+on the server. The user should provide the user parameter
+and the password parameter while initiating the InstallersClient.
+
+Input for the function :
+ * scenario_name
+ * installer-json : Json object of the installer
+
+.. NOTE::
+ installer_json schema - '{ "versions": [],
+ "installer": ""}'
+
+ See version for version_schema
+
+.. code-block:: shell
+
+ from testapiclient.client import installers
+
+ installer_client = installers.InstallersClient(user='test', password='pass')
+ installer_client.create(scenario_name, installer_json)
+
+UPDATE
+""""""
+
+This method used to update the all existing installers of a scenario
+The user should provide the user parameter and the password
+parameter while initiating the InstallersClient.
+
+Input for the function :
+
+ * scenario_name
+ * installer-json: Json object of the installer
+
+.. NOTE::
+ * scenario_name
+ * installer_json schema - [{ "versions": [], "installer": ""}]
+
+.. code-block:: shell
+
+ from testapiclient.client import installers
+
+ installer_client = installers.InstallersClient(user='test', password='pass')
+ installer_client.update(scenario_name, installer_update_json)
+
+DELETE
+""""""
+
+This method used to delete existing installers from a scenario.
+on the server.
+The user should provide the user parameter and the password
+parameter while initiating the InstallersClient.
+
+Input for the function :
+ * scenario_name
+ * installer_names: names of the installer which user want to delete.
+
+.. code-block:: shell
+
+ from testapiclient.client import installers
+
+ installer_client = installers.InstallersClient(user='test', password='pass')
+ installer_client.delete(scenario_name, installer_names)
+
+Scenario Version
+^^^^^^^^^^^^^^^^
+
+CREATE
+""""""
+
+This method used to create a version under a scenario
+on the server. The user should provide the user parameter
+and the password parameter while initiating the VersionsClient.
+
+Input for the function :
+
+ * scenario_name
+ * installer_name
+ * version-json : Json object of the version
+
+.. NOTE::
+ version_json schema - '{ "projects": [], "owner": "",
+ "version": ""}'
+
+ See version for version_schema
+
+.. code-block:: shell
+
+ from testapiclient.client import versions
+
+ version_client = versions.VersionsClient(user='test', password='pass')
+ version_client.create(scenario_name, installer_name, version_json)
+
+UPDATE
+""""""
+
+This method used to update the all existing versions of a scenario
+The user should provide the user parameter and the password
+parameter while initiating the VersionsClient.
+
+Input for the function :
+
+ * scenario_name
+ * installer_name
+ * version-json: Json object of the version
+
+.. NOTE::
+ * scenario_name
+ * version_json schema - [{ "projects": [], "owner": "", "version": ""}]
+
+.. code-block:: shell
+
+ from testapiclient.client import versions
+
+ version_client = versions.VersionsClient(user='test', password='pass')
+ version_client.update(scenario_name, installer_name, version_update_json)
+
+DELETE
+""""""
+
+This method used to delete existing versions from a scenario.
+on the server.
+The user should provide the user parameter and the password
+parameter while initiating the VersionsClient.
+
+Input for the function :
+ * scenario_name
+ * installer_name
+ * version_names: names of the version which user want to delete.
+
+.. code-block:: shell
+
+ from testapiclient.client import versions
+
+ version_client = versions.VersionsClient(user='test', password='pass')
+ version_client.delete(scenario_name, installer_name, version_names)
+
+Scenario Project
+^^^^^^^^^^^^^^^^
+
+CREATE
+""""""
+
+This method used to create a project under a scenario
+on the server. The user should provide the user parameter
+and the password parameter while initiating the ProjectsClient.
+
+Input for the function :
+
+ * scenario_name
+ * installer_name
+ * version_name
+ * project-json : Json object of the project
+
+.. NOTE::
+ project_json schema - '{ "scores": [], "trust_indcators": [],
+ "customs": [], "project": ""}'
+
+ See project for project_schema
+
+.. code-block:: shell
+
+ from testapiclient.client import projects
+
+ project_client = projects.ProjectsClient(user='test', password='pass')
+ project_client.create(scenario_name, installer_name, version_name, project_json)
+
+UPDATE
+""""""
+
+This method used to update the all existing projects of a scenario
+The user should provide the user parameter and the password
+parameter while initiating the ProjectsClient.
+
+Input for the function :
+
+ * scenario_name
+ * installer_name
+ * version_name
+ * project-json: Json object of the project
+
+.. NOTE::
+ * scenario_name
+ * project_json schema - [{"scores": [], "trust_indcators": [], "customs": [], "project": ""}]
+
+.. code-block:: shell
+
+ from testapiclient.client import projects
+
+ project_client = projects.ProjectsClient(user='test', password='pass')
+ project_client.update(scenario_name, installer_name, version_name, project_update_json)
+
+DELETE
+""""""
+
+This method used to delete existing projects from a scenario.
+on the server.
+The user should provide the user parameter and the password
+parameter while initiating the ProjectsClient.
+
+Input for the function :
+ * scenario_name
+ * installer_name
+ * version_name
+ * project_names: names of the project which user want to delete.
+
+.. code-block:: shell
+
+ from testapiclient.client import projects
+
+ project_client = projects.ProjectsClient(user='test', password='pass')
+ project_client.delete(scenario_name, installer_name, version_name, project_names)
+
+Scenario Custom
+^^^^^^^^^^^^^^^
+
+CREATE
+""""""
+
+This method used to create a custom under a scenario
+on the server. The user should provide the user parameter
+and the password parameter while initiating the CustomsClient.
+
+Input for the function :
+
+ * scenario_name
+ * installer_name
+ * version_name
+ * project_name
+ * custom : List of Customs
+
+.. NOTE::
+ * scenario_name
+ * custom schema - ["List of Strings"]
+
+ See custom for custom_schema
+
+.. code-block:: shell
+
+ from testapiclient.client import customs
+
+ custom_client = customs.CustomsClient(user='test', password='pass')
+ custom_client.create(scenario_name, installer_name, version_name,
+ project_name, custom_json)
+
+UPDATE
+""""""
+
+This method used to update the all existing customs of a scenario
+The user should provide the user parameter and the password
+parameter while initiating the CustomsClient.
+
+Input for the function :
+
+ * scenario_name
+ * installer_name
+ * version_name
+ * project_name
+ * custom : List of Customs
+
+.. NOTE::
+ * scenario_name
+ * custom schema - ["List of Strings"]
+
+.. code-block:: shell
+
+ from testapiclient.client import customs
+
+ custom_client = customs.CustomsClient(user='test', password='pass')
+ custom_client.update(scenario_name, installer_name, version_name,
+ project_name custom)
+
+DELETE
+""""""
+
+This method used to delete existing customs from a scenario.
+on the server.
+The user should provide the user parameter and the password
+parameter while initiating the CustomsClient.
+
+Input for the function :
+ * scenario_name
+ * installer_name
+ * version_name
+ * project_name
+ * custom: custom which user want to delete.
+
+.. code-block:: shell
+
+ from testapiclient.client import customs
+
+ custom_client = customs.CustomsClient(user='test', password='pass')
+ custom_client.delete(scenario_name, installer_name, version_name,
+ project_name, customs)
+
+Scenario Scores
+^^^^^^^^^^^^^^^
+
+CREATE
+""""""
+
+This method used to create a score under a scenario
+on the server. The user should provide the user parameter
+and the password parameter while initiating the ScoresClient.
+
+Input for the function :
+
+ * scenario_name
+ * installer_name
+ * version_name
+ * project_name
+ * score_json : Schema for the score
+
+.. NOTE::
+ * scenario_name
+ * score_json schema - '{ "date": "", "score": ""}'
+
+ See score for score_schema
+
+.. code-block:: shell
+
+ from testapiclient.client import scores
+
+ score_client = scores.ScoresClient(user='test', password='pass')
+ score_client.create(scenario_name, installer_name, version_name,
+ project_name, score_json)
+
+Scenario TrustIndicator
+^^^^^^^^^^^^^^^^^^^^^^^
+
+CREATE
+""""""
+
+This method used to create a trust indicator under a scenario
+on the server. The user should provide the user parameter
+and the password parameter while initiating the TrustIndicatorsClient.
+
+Input for the function :
+
+ * scenario_name
+ * installer_name
+ * version_name
+ * project_name
+ * trust_indicator_json : Schema for the trust_indicator
+
+.. NOTE::
+ * scenario_name
+ * trust_indicator_json schema - '{ "date": "", "status": ""}'
+
+ See trust_indicator for trust_indicator_schema
+
+.. code-block:: shell
+
+ from testapiclient.client import trust_indicators
+
+ trust_indicator_client = trust_indicators.TrustIndicatorsClient(user='test', password='pass')
+ trust_indicator_client.create(scenario_name, installer_name, version_name,
+ project_name, trust_indicator_json) \ No newline at end of file
diff --git a/testapi/testapi-client/testapiclient/client/scenarios.py b/testapi/testapi-client/testapiclient/client/scenarios.py
index fde673a..e5ce2f1 100644
--- a/testapi/testapi-client/testapiclient/client/scenarios.py
+++ b/testapi/testapi-client/testapiclient/client/scenarios.py
@@ -13,9 +13,14 @@ class ScenariosClient(base.Client):
def create(self, scenario_req):
return self.clientmanager.post(self.url, scenario_req)
- def get(self):
- return json.dumps(
- self.clientmanager.get(self.url)['scenarios'])
+ def get(self, **queries):
+ if queries:
+ return json.dumps(
+ self.clientmanager.get(
+ urlparse.query_join(self.url, **queries))['scenarios'])
+ else:
+ return json.dumps(
+ self.clientmanager.get(self.url)['scenarios'])
def get_one(self, scenario_name):
return json.dumps(