Skip to content

Commit

Permalink
Review: Tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Marvin Wichmann committed Sep 21, 2020
1 parent 0dd9dcb commit 88b6a42
Showing 1 changed file with 45 additions and 0 deletions.
45 changes: 45 additions & 0 deletions test/devices_tests/cover_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -231,6 +231,28 @@ def test_set_short_down(self):
telegram, Telegram(GroupAddress("1/2/1"), payload=DPTBinary(1))
)

#
# TEST SET DOWN INVERTED
#
def test_set_down_inverted(self):
"""Test moving cover to 'down' position."""
xknx = XKNX(loop=self.loop)
cover = Cover(
xknx,
"TestCover",
group_address_long="1/2/1",
group_address_short="1/2/2",
group_address_position="1/2/3",
group_address_position_state="1/2/4",
invert_position=True,
)
self.loop.run_until_complete(cover.set_down())
self.assertEqual(xknx.telegrams.qsize(), 1)
telegram = xknx.telegrams.get_nowait()
self.assertEqual(
telegram, Telegram(GroupAddress("1/2/1"), payload=DPTBinary(0))
)

#
# TEST SET SHORT UP
#
Expand All @@ -253,6 +275,29 @@ def test_set_short_up(self):
telegram, Telegram(GroupAddress("1/2/2"), payload=DPTBinary(0))
)

#
# TEST SET UP INVERTED
#
def test_set_up_inverted(self):
"""Test moving cover 'short up'."""
xknx = XKNX(loop=self.loop)
cover = Cover(
xknx,
"TestCover",
group_address_long="1/2/1",
group_address_short="1/2/2",
group_address_position="1/2/3",
group_address_position_state="1/2/4",
invert_position=True,
)
self.loop.run_until_complete(cover.set_short_up())
self.assertEqual(xknx.telegrams.qsize(), 1)
telegram = xknx.telegrams.get_nowait()
# DPT 1.008 - 0:up 1:down
self.assertEqual(
telegram, Telegram(GroupAddress("1/2/2"), payload=DPTBinary(1))
)

#
# TEST SET SHORT DOWN
#
Expand Down

0 comments on commit 88b6a42

Please sign in to comment.