aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--pyagl/tests/test_hvac.py32
1 files changed, 32 insertions, 0 deletions
diff --git a/pyagl/tests/test_hvac.py b/pyagl/tests/test_hvac.py
index b265819..0c4d1c6 100644
--- a/pyagl/tests/test_hvac.py
+++ b/pyagl/tests/test_hvac.py
@@ -72,3 +72,35 @@ async def test_set(event_loop, service: hvs):
resp = await service.afbresponse()
assert resp.status == 'success'
+async def test_set_bad_request(event_loop, service: hvs):
+ msgid = await service.set({'FanSpeed': -1})
+ resp = await service.afbresponse()
+ assert resp.status == 'bad-request'
+
+ msgid = await service.set({'FanSpeed': 256})
+ resp = await service.afbresponse()
+ assert resp.status == 'bad-request'
+
+ msgid = await service.set({'FanSpeed': 'aa'})
+ resp = await service.afbresponse()
+ assert resp.status == 'bad-request'
+
+async def test_set_success(event_loop, service: hvs):
+ msgid = await service.set({'FanSpeed': 255})
+ resp = await service.afbresponse()
+ assert resp.status == 'success'
+
+ msgid = await service.get_fanspeed()
+ resp = await service.afbresponse()
+ assert resp.status == 'success'
+ assert resp.data == {'FanSpeed': 255}
+
+ msgid = await service.set({'FanSpeed': 0})
+ resp = await service.afbresponse()
+ assert resp.status == 'success'
+
+ msgid = await service.get_fanspeed()
+ resp = await service.afbresponse()
+ assert resp.status == 'success'
+ assert resp.data == {'FanSpeed': 0}
+