Skip to main content

opentmi-client

Project description

Python Client library for OpenTMI

CircleCI Coverage Status PyPI version

This is the Python client library for OpenTMI.

installation

To install, simply use pip:

$ pip install --upgrade opentmi-client

See the Developers Guide if you want to develop this library.

Command Line Interface

Library provides Command line Interface to communicate with OpenTMI -backend

$ opentmi --help
usage: opentmi [-h] [-v] [-s] [--host HOST] [--user USER]
               [--password PASSWORD] [--token TOKEN]
               [--token_service TOKEN_SERVICE] [-p PORT]
               <subcommand> ...

optional arguments:
  -h, --help            show this help message and exit
  -v                    verbose level... repeat up to three times.
  -s, --silent          Silent - only errors will be printed
  --host HOST           OpenTMI host, default: localhost
  --user USER           username
  --password PASSWORD   password
  --token TOKEN         Authentication token
  --token_service TOKEN_SERVICE
                        Optional authentication service
  -p PORT, --port PORT  OpenTMI port

subcommand:
  <subcommand>          sub-command help
    version             Display version information
    list                List something
    store               Create something

example:

opentmi --host localhost --port 3000 --list --testcases 1

Python API

from opentmi_client import OpenTmiClient, Result, Event
client = Client("https://127.0.0.1")
client.login_with_access_token("my-github-access-token")

# post result
result = Result()
result.tcid = "test-case-a"
result.verdict = "pass"
client.post_result(result)

# post event
event = Event()
event.msgid = "ALLOCATED"
event.priority.level = "info",
event.ref.resource = "5697740f956cd2fd35c69062"
client.post_event(event)

See more examples from here.

Server side Result schema can be found from here. and Test case schema is available here.

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.

Authentication

There are multiple options to authenticate:

  • use Client.login(<username>, <password>)
  • use Client.login_with_access_token(<token>, [<service>])
    • service are optional and supported values depend on server support. By default github is in use.
  • Use environment variables (tries login automatically when constructor is called):
    • Using username and password: OPENTMI_USERNAME and OPENTMI_PASSWORD or
    • Using github access token: OPENTMI_GITHUB_ACCESS_TOKEN
  • use token in host like http://<token>@localhost

LICENSE

MIT

Project details


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.10.2.tar.gz (33.5 kB view details)

Uploaded Source

Built Distribution

opentmi_client-0.10.2-py3-none-any.whl (43.1 kB view details)

Uploaded Python 3

File details

Details for the file opentmi_client-0.10.2.tar.gz.

File metadata

  • Download URL: opentmi_client-0.10.2.tar.gz
  • Upload date:
  • Size: 33.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.0 CPython/3.7.12

File hashes

Hashes for opentmi_client-0.10.2.tar.gz
Algorithm Hash digest
SHA256 625c8647ad1a9f9039f8dbf19c1dc02c4f1d9f0fae59b0f7c1ddc827eb057cb1
MD5 b6add9212b8dcf662869b2b22c2663ab
BLAKE2b-256 32014cbcdfefc26f0be47e90ad26cac02cdc0a758da4e2f6055932ba92fb4731

See more details on using hashes here.

File details

Details for the file opentmi_client-0.10.2-py3-none-any.whl.

File metadata

File hashes

Hashes for opentmi_client-0.10.2-py3-none-any.whl
Algorithm Hash digest
SHA256 2d1b184e6d7cb7d189bcbcf826b6c924498a4bb9b7bd1aa31932c094b6a04460
MD5 d0db61b3db6e2f4f4a0bc81253396c21
BLAKE2b-256 081ee0730c645db643a3549a376d5079c9b181ef947be3fcbe7183633a86343a

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page