aboutsummaryrefslogtreecommitdiffstats
path: root/library/recipes/tvmtool/examples/ut_with_custom_config/test.py
blob: 9cbf48dd85e57c269e52fdcb2f62ed4d153f771d (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
import os
import os.path
import requests

TVMTOOL_PORT_FILE = "tvmtool.port"
TVMTOOL_AUTHTOKEN_FILE = "tvmtool.authtoken"


def _get_tvmtool_params():
    port = int(open(TVMTOOL_PORT_FILE).read())
    authtoken = open(TVMTOOL_AUTHTOKEN_FILE).read()
    return port, authtoken


def test_tvmtool():
    assert os.path.isfile(TVMTOOL_PORT_FILE)
    assert os.path.isfile(TVMTOOL_AUTHTOKEN_FILE)

    port, authtoken = _get_tvmtool_params()

    r = requests.get("http://localhost:%d/tvm/ping" % port)
    assert r.text == 'OK'
    assert r.status_code == 200