diff --git a/tests/test_gateway_result_code.py b/tests/test_gateway_result_code.py new file mode 100644 index 0000000..73e446b --- /dev/null +++ b/tests/test_gateway_result_code.py @@ -0,0 +1,15 @@ +# flake8: noqa + +import pytest + +from wirepas_mesh_messaging.proto import ErrorCode +from wirepas_mesh_messaging import GatewayResultCode + +@pytest.mark.parametrize("protobuf_result_code", ErrorCode.items()) +def test_decoding_errors(protobuf_result_code): + name, value = protobuf_result_code + try: + GatewayResultCode(value) + except ValueError as e: + raise ValueError(f"{name} is not defined in GatewayResultCode") from e + diff --git a/wirepas_mesh_messaging/gateway_result_code.py b/wirepas_mesh_messaging/gateway_result_code.py index 738cc14..2d449df 100644 --- a/wirepas_mesh_messaging/gateway_result_code.py +++ b/wirepas_mesh_messaging/gateway_result_code.py @@ -50,3 +50,5 @@ class GatewayResultCode(enum.Enum): GW_RES_INVALID_MAX_HOP_COUNT = INVALID_MAX_HOP_COUNT GW_RES_SINK_OUT_OF_MEMORY = SINK_OUT_OF_MEMORY GW_RES_SINK_TIMEOUT = SINK_TIMEOUT + GW_RES_INVALID_SCRATCHPAD_CHUNK_OFFSET = INVALID_SCRATCHPAD_CHUNK_OFFSET + GW_RES_INVALID_SCRATCHPAD_CHUNK_SIZE = INVALID_SCRATCHPAD_CHUNK_SIZE