1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48
|
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""Some basic functions to test the roon api."""
import os.path
from roonapi import RoonApi
def test_basic():
try:
host = open("test_core_server_file").read()
port = open("test_core_port_file").read()
token = open("my_token_file").read()
except OSError:
print("Please authorise first using discovery.py")
exit()
appinfo = {
"extension_id": "python_roon_test",
"display_name": "Python library for Roon",
"display_version": "1.0.0",
"publisher": "pavoni",
"email": "my@email.com",
}
with RoonApi(appinfo, token, host, port, True) as roonapi:
# Test basic zone fetching
zones = [zone["display_name"] for zone in roonapi.zones.values()]
zones.sort()
assert len(zones) == 7
assert zones == [
"95 Office",
"Bedroom",
"Hi Fi",
"Kitchen",
"Shower",
"Study",
"Tuner",
]
# Test basic output fetching
output_count = len(roonapi.outputs)
assert output_count == 8
token = roonapi.token
roonapi.stop()
|