MCPcopy Create free account
hub / github.com/Serial-Studio/Serial-Studio / _fuzz_send

Function _fuzz_send

tests/security/test_api_command_fuzzing.py:82–95  ·  view source on GitHub ↗

Send one fuzz command. APIError -> server rejected the input cleanly (pass). ConnectionError -> server defensively dropped the client (pass); reconnect. TimeoutError -> not caught here; it means a hang and must fail the test.

(api_client, command, params)

Source from the content-addressed store, hash-verified

80
81
82def _fuzz_send(api_client, command, params):
83 """Send one fuzz command.
84
85 APIError -> server rejected the input cleanly (pass).
86 ConnectionError -> server defensively dropped the client (pass); reconnect.
87 TimeoutError -> not caught here; it means a hang and must fail the test.
88 """
89 try:
90 api_client.command(command, params)
91 except APIError:
92 pass
93 except ConnectionError:
94 api_client.disconnect()
95 api_client.connect()
96
97
98def _assert_server_alive(api_client):

Callers 3

test_random_param_fuzzFunction · 0.85

Calls 3

commandMethod · 0.80
disconnectMethod · 0.45
connectMethod · 0.45

Tested by

no test coverage detected