Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions tests/test_gateway_result_code.py
Original file line number Diff line number Diff line change
@@ -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

2 changes: 2 additions & 0 deletions wirepas_mesh_messaging/gateway_result_code.py
Original file line number Diff line number Diff line change
Expand Up @@ -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