diff --git a/tests/test_rainbird.py b/tests/test_rainbird.py index e0678b6..e7733e2 100644 --- a/tests/test_rainbird.py +++ b/tests/test_rainbird.py @@ -57,98 +57,3 @@ class TestSequence(unittest.TestCase): ) def test_encode(self, expected, command, *vargs): self.assertEqual(expected, encode(command, *vargs)) - - @parameterized.expand( - [ - [ - { - "type": "NotAcknowledgeResponse", - "commandEcho": 2, - "NAKCode": 3, - }, - "000203", - ], - [{"type": "AcknowledgeResponse", "commandEcho": 6}, "0106"], - [ - { - "type": "ModelAndVersionResponse", - "modelID": 6, - "protocolRevisionMajor": 9, - "protocolRevisionMinor": 12, - }, - "820006090C", - ], - [ - { - "type": "AvailableStationsResponse", - "pageNumber": 15, - "setStations": 16, - }, - "830F0010", - ], - [ - { - "type": "CommandSupportResponse", - "commandEcho": 0x82, - "support": 1, - }, - "848201", - ], - [ - {"type": "SerialNumberResponse", "serialNumber": 0x8963}, - "850000000000008963", - ], - [ - { - "type": "CurrentTimeResponse", - "hour": 12, - "minute": 54, - "second": 35, - }, - "900C3623", - ], - [ - { - "type": "CurrentDateResponse", - "day": 18, - "month": 11, - "year": 2018, - }, - "9212B7E2", - ], - [ - { - "type": "WaterBudgetResponse", - "programCode": 3, - "seasonalAdjust": 0x83, - }, - "B0030083", - ], - [ - {"type": "CurrentRainSensorStateResponse", "sensorState": 1}, - "BE01", - ], - [ - { - "type": "CurrentStationsActiveResponse", - "pageNumber": 1, - "activeStations": 0b00010000000000000000000000000000, - }, - "BF0110000000", - ], - [ - {"type": "RainDelaySettingResponse", "delaySetting": 3}, - "B60003", - ], - [ - { - "type": "CurrentIrrigationStateResponse", - "irrigationState": 1, - }, - "C801", - ], - ], - name_func=decode_name_func, - ) - def test_decode(self, expected, data): - self.assertEqual(expected, decode(data)) diff --git a/tests/testdata/ack.yaml b/tests/testdata/ack.yaml new file mode 100644 index 0000000..4ec7721 --- /dev/null +++ b/tests/testdata/ack.yaml @@ -0,0 +1,13 @@ +data: + - "0106" + - "000203" + - "848201" +decoded_data: + - type: AcknowledgeResponse + commandEcho: 6 + - type: NotAcknowledgeResponse + commandEcho: 2 + NAKCode: 3 + - type: CommandSupportResponse + commandEcho: 0x82 + support: 1 diff --git a/tests/testdata/available_stations.yaml b/tests/testdata/available_stations.yaml new file mode 100644 index 0000000..3979c3d --- /dev/null +++ b/tests/testdata/available_stations.yaml @@ -0,0 +1,6 @@ +data: + - 830F0010 +decoded_data: + - type: AvailableStationsResponse + pageNumber: 15 + setStations: 16 diff --git a/tests/testdata/date_time.yaml b/tests/testdata/date_time.yaml new file mode 100644 index 0000000..5343910 --- /dev/null +++ b/tests/testdata/date_time.yaml @@ -0,0 +1,13 @@ +data: + - "900C3623" + - "9212B7E2" +decoded_data: + - type: CurrentTimeResponse + hour: 12 + minute: 54 + second: 35 + - type: CurrentDateResponse + year: 2018 + month: 11 + day: 18 + diff --git a/tests/testdata/irrigation_state.yaml b/tests/testdata/irrigation_state.yaml new file mode 100644 index 0000000..55454fe --- /dev/null +++ b/tests/testdata/irrigation_state.yaml @@ -0,0 +1,5 @@ +data: + - "C801" +decoded_data: + - type: CurrentIrrigationStateResponse + irrigationState: 1 diff --git a/tests/testdata/model_and_version.yaml b/tests/testdata/model_and_version.yaml new file mode 100644 index 0000000..03a2f38 --- /dev/null +++ b/tests/testdata/model_and_version.yaml @@ -0,0 +1,10 @@ +data: + - "820006090C" + - "850000000000008963" +decoded_data: + - type: ModelAndVersionResponse + modelID: 6 + protocolRevisionMajor: 9 + protocolRevisionMinor: 12 + - type: SerialNumberResponse + serialNumber: 0x8963 diff --git a/tests/testdata/rain_delay.yaml b/tests/testdata/rain_delay.yaml new file mode 100644 index 0000000..9f4dcfc --- /dev/null +++ b/tests/testdata/rain_delay.yaml @@ -0,0 +1,5 @@ +data: + - "B60003" +decoded_data: + - type: RainDelaySettingResponse + delaySetting: 3 diff --git a/tests/testdata/rain_sensor.yaml b/tests/testdata/rain_sensor.yaml new file mode 100644 index 0000000..2ed79ed --- /dev/null +++ b/tests/testdata/rain_sensor.yaml @@ -0,0 +1,5 @@ +data: + - "BE01" +decoded_data: + - type: CurrentRainSensorStateResponse + sensorState: 1