Skip to content

Commit

Permalink
finished rework of class GatewayApiTestCase()
Browse files Browse the repository at this point in the history
  • Loading branch information
gjr80 committed Aug 6, 2023
1 parent 026884d commit 3185210
Showing 1 changed file with 14 additions and 8 deletions.
22 changes: 14 additions & 8 deletions bin/user/tests/test_egd.py
Original file line number Diff line number Diff line change
Expand Up @@ -1226,7 +1226,6 @@ class GatewayApiTestCase(unittest.TestCase):
# API command code (byte) for CMD_READ_FIRMWARE_VERSION, used for various
# tests that require an issuing an API command
cmd_read_fware_code_byte = b'\x50'
read_fware_cmd_bytes = b'\xff\xffP\x03S'
# known good read firmware (CMD_READ_FIRMWARE_VERSION) response bytes
read_fware_resp_bytes = b'\xff\xffP\x11\rGW1000_V1.6.1v'
# read firmware (CMD_READ_FIRMWARE_VERSION) response bytes with a bad
Expand Down Expand Up @@ -1625,13 +1624,20 @@ def test_rediscovery(self, mock_get_mac, mock_get_firmware, mock_get_system_para
Checks gw1000.GatewayApi.rediscover correctly rediscovers devices. This
is performed using the following test elements:
1. check that gw1000.GatewayApi.rediscover() correctly rediscovers a previously discovered device
2. check that gw1000.GatewayApi.rediscover() raises an
InvalidChecksum exception when validating an API response with an
invalid checksum
3. check that gw1000.GatewayApi.check_response() raises an
UnknownApiCommand exception when validating an API response with a
valid checksum but with an unexpected command code
1. check that gw1000.GatewayApi.rediscover() correctly rediscovers a
previously discovered device with the same IP address and port
2. check that gw1000.GatewayApi.rediscover() correctly rediscovers a
previously discovered device with a different IP address and port
3. check that gw1000.GatewayApi.rediscover() correctly handles the
situation where multiple devices are discovered but does not include
the previously discovered device
4. check that gw1000.GatewayApi.rediscover() correctly handles the
situation where no devices are discovered
5. check that gw1000.GatewayApi.rediscover() correctly handles the
situation when gw1000.GatewayApi.discover() raises a socket.error
6. check that gw1000.GatewayApi.rediscover() correctly handles the
situation when gw1000.GatewayApi.discover() raises a
user.gw1000.UnknonwApiCommand exception
This test uses mocked return values from various gw1000.GatewayApi
methods to allow the test to be run without a physical gateway device.
Expand Down

0 comments on commit 3185210

Please sign in to comment.