opentmi-client
Project description
# Python Client library for OpenTMI
[![CircleCI](https://circleci.com/gh/OpenTMI/opentmi-pyclient/tree/master.svg?style=svg)](https://circleci.com/gh/OpenTMI/opentmi-pyclient/tree/master)
[![Coverage Status](https://coveralls.io/repos/github/OpenTMI/opentmi-pyclient/badge.svg)](https://coveralls.io/github/OpenTMI/opentmi-pyclient)
This library purpose is to provide simple interface for OpenTMI -backend.
## installation
`python setup.py install`
## Test
`python setup.py test`
## Compile documentation
```
sphinx-apidoc -o docs/_static opentmi_client
make -C docs html
```
## Command Line Interface
Library provides Command line Interface to communicate with OpenTMI -backend
```
/> opentmi --help
usage: opentmi [-h] [--version VERSION] [--host HOST] [-p PORT] [--list LIST]
[--testcases TESTCASES]
optional arguments:
-h, --help show this help message and exit
--version VERSION Prints package version and exits
--host HOST OpenTMI host, default: localhost
-p PORT, --port PORT OpenTMI port
--list LIST List something
--testcases TESTCASES
```
example:
```
opentmi --host localhost --port 3000 --list --testcases 1
```
## Python API
```
from opentmi_client import Client
client = Client(host='127.0.0.1', port=3000)
campaigns = client.get_campaigns()
testcases = client.get_testcases()
result = {
"tcid": "test-case",
"campaign": "my-campaign",
"exec": {
"verdict": "pass",
"duration": "8",
},
"sut": {
"gitUrl": "github.com/opentmi/opentmi",
"commitId": "123",
},
"dut": {
"type": "hw",
"vendor": "ABC",
"model": "platform#1",
"sn": "123"
}
}
client.upload_results(result) # require valid result json object or converter function
```
Alternative you can set `result_converter()` and `testcase_converter()` -functions in OpenTmiClient constructor.
Converter functions will be used to convert application specific result object for opentmi suitable format.
Suitable result schema is described [here](https://github.com/OpenTMI/opentmi/blob/master/app/models/results.js#L15).
Test case document schema is available [here](https://github.com/OpenTMI/opentmi/blob/master/app/models/testcase.js).
**notes**
* `tcid` -field have to be unique for each test cases.
* There is couple mandatory fields by default: `tcid` and `exec.verdict`. Allowed values for result verdict is: `pass`, `fail`, `inconclusive`, `blocked` and `error`. `upload_results()` -function also create test case document if it doesn't exists in database.
LICENSE: MIT
[![CircleCI](https://circleci.com/gh/OpenTMI/opentmi-pyclient/tree/master.svg?style=svg)](https://circleci.com/gh/OpenTMI/opentmi-pyclient/tree/master)
[![Coverage Status](https://coveralls.io/repos/github/OpenTMI/opentmi-pyclient/badge.svg)](https://coveralls.io/github/OpenTMI/opentmi-pyclient)
This library purpose is to provide simple interface for OpenTMI -backend.
## installation
`python setup.py install`
## Test
`python setup.py test`
## Compile documentation
```
sphinx-apidoc -o docs/_static opentmi_client
make -C docs html
```
## Command Line Interface
Library provides Command line Interface to communicate with OpenTMI -backend
```
/> opentmi --help
usage: opentmi [-h] [--version VERSION] [--host HOST] [-p PORT] [--list LIST]
[--testcases TESTCASES]
optional arguments:
-h, --help show this help message and exit
--version VERSION Prints package version and exits
--host HOST OpenTMI host, default: localhost
-p PORT, --port PORT OpenTMI port
--list LIST List something
--testcases TESTCASES
```
example:
```
opentmi --host localhost --port 3000 --list --testcases 1
```
## Python API
```
from opentmi_client import Client
client = Client(host='127.0.0.1', port=3000)
campaigns = client.get_campaigns()
testcases = client.get_testcases()
result = {
"tcid": "test-case",
"campaign": "my-campaign",
"exec": {
"verdict": "pass",
"duration": "8",
},
"sut": {
"gitUrl": "github.com/opentmi/opentmi",
"commitId": "123",
},
"dut": {
"type": "hw",
"vendor": "ABC",
"model": "platform#1",
"sn": "123"
}
}
client.upload_results(result) # require valid result json object or converter function
```
Alternative you can set `result_converter()` and `testcase_converter()` -functions in OpenTmiClient constructor.
Converter functions will be used to convert application specific result object for opentmi suitable format.
Suitable result schema is described [here](https://github.com/OpenTMI/opentmi/blob/master/app/models/results.js#L15).
Test case document schema is available [here](https://github.com/OpenTMI/opentmi/blob/master/app/models/testcase.js).
**notes**
* `tcid` -field have to be unique for each test cases.
* There is couple mandatory fields by default: `tcid` and `exec.verdict`. Allowed values for result verdict is: `pass`, `fail`, `inconclusive`, `blocked` and `error`. `upload_results()` -function also create test case document if it doesn't exists in database.
LICENSE: MIT
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
opentmi_client-0.3.2.tar.gz
(14.4 kB
view hashes)
Built Distributions
opentmi_client-0.3.2-py2.7.egg
(28.2 kB
view hashes)
Close
Hashes for opentmi_client-0.3.2-py2-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | de36a771dba1c4bb17e9fa1f331f4c4e3d3f113ad5448bc98ca64249a73c6fe0 |
|
MD5 | 7ca76c95d05f2e562d699f48b2a6dae3 |
|
BLAKE2b-256 | 6533b1fe5bf0fc6a799a4643391f6c9050bfcd063a7d8ea762a7eace72ffbfaa |