-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathtest_pybeoplay_simulated.py
57 lines (41 loc) · 1.29 KB
/
test_pybeoplay_simulated.py
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
49
50
51
52
53
54
55
56
import responses
from pybeoplay import BeoPlay
from pybeoplay.const import BEOPLAY_URL_STAND, BEOPLAY_URL_STAND_ACTIVE
import logging
LOG = logging.getLogger(__name__)
@responses.activate
def test_standpositions(gateway: BeoPlay):
# register via direct arguments
with open('standpositionstest.json', 'r') as file:
content = file.read()
file.close()
responses.add(
responses.GET,
"http://192.168.1.98:8080/" + BEOPLAY_URL_STAND,
body=content.encode('utf-8'),
status=200,
)
with open('standpositiontest.json', 'r') as file:
content = file.read()
file.close()
responses.add(
responses.GET,
"http://192.168.1.98:8080/" + BEOPLAY_URL_STAND_ACTIVE,
body=content.encode('utf-8'),
status=200,
)
print ("--- STAND POSITIONS ---")
gateway.getStandPositions()
print (gateway.standPositions)
gateway.getStandPosition()
print ("Stand Position: ", gateway.standPosition)
if __name__ == '__main__':
import sys
ch = logging.StreamHandler(sys.stdout)
logging.basicConfig(level=logging.DEBUG)
ch.setLevel(logging.DEBUG)
LOG.addHandler(ch)
if len(sys.argv) < 2:
quit()
gateway = BeoPlay(sys.argv[1])
test_standpositions(gateway)