Giter VIP home page Giter VIP logo

opentmi-pyclient's Introduction

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

opentmi-pyclient's People

Contributors

jupe avatar jonikula avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.