Skip to content

Commit

Permalink
Clean up duplicate test case; further organize response formatters test
Browse files Browse the repository at this point in the history
  • Loading branch information
fselmo committed Apr 24, 2024
1 parent 86c6eea commit f7d86b8
Showing 1 changed file with 9 additions and 13 deletions.
22 changes: 9 additions & 13 deletions tests/core/manager/test_response_formatters.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,20 +84,23 @@
{"error": {"code": -32601, "message": (METHOD_UNAVAILABLE_MSG)}},
)
ERROR_RESPONSE_INVALID_ID = merge(VALID_ERROR_RESPONSE, {"id": b"invalid"})
ERROR_RESPONSE_INVALID_ERROR_OBJECT = merge(
VALID_ERROR_RESPONSE, {"error": METHOD_UNAVAILABLE_MSG}
)

ERROR_RESPONSE_INVALID_CODE = merge(VALID_ERROR_RESPONSE, {"error": {"code": "-32601"}})
ERROR_RESPONSE_INVALID_MESSAGE = merge(
VALID_ERROR_RESPONSE, {"error": {"code": -32000, "message": {}}}
)
ERROR_RESPONSE_INVALID_MISSING_CODE = merge(
VALID_ERROR_RESPONSE, {"error": {"message": "msg"}}
)

ERROR_RESPONSE_INVALID_MESSAGE = merge(
VALID_ERROR_RESPONSE, {"error": {"code": -32000, "message": {}}}
)
ERROR_RESPONSE_INVALID_MISSING_MESSAGE = merge(
VALID_ERROR_RESPONSE, {"error": {"code": -32000}}
)

ERROR_RESPONSE_INVALID_ERROR_OBJECT = merge(
VALID_ERROR_RESPONSE, {"error": METHOD_UNAVAILABLE_MSG}
)

# result object validation
VALID_RESPONSE_NULL_RESULT = merge(VALID_RESULT_OBJ_RESPONSE, {"result": None})
VALID_RESPONSE_0x_RESULT = merge(VALID_RESULT_OBJ_RESPONSE, {"result": "0x"})
Expand Down Expand Up @@ -283,13 +286,6 @@ def test_formatted_response_invalid_error_object(
Web3RPCError,
f'{VALID_ERROR_RESPONSE["error"]}\nUser message: {DEFAULT_USER_MSG}',
),
(
# Valid error response with no null result formatters raises `Web3RPCError`
identity,
identity,
Web3RPCError,
f'{VALID_ERROR_RESPONSE["error"]}\nUser message: {DEFAULT_USER_MSG}',
),
),
)
def test_formatted_response_error_responses_with_formatters_raise_expected_exceptions(
Expand Down

0 comments on commit f7d86b8

Please sign in to comment.