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

Function security_client

tests/security/conftest.py:95–117  ·  view source on GitHub ↗

Provide an API client for security testing. Does NOT automatically clean state - security tests may want to test dirty/invalid states. Skips test if server is unavailable (e.g., crashed by previous test).

(api_server_required)

Source from the content-addressed store, hash-verified

93
94@pytest.fixture
95def security_client(api_server_required):
96 """
97 Provide an API client for security testing.
98
99 Does NOT automatically clean state - security tests may want
100 to test dirty/invalid states.
101
102 Skips test if server is unavailable (e.g., crashed by previous test).
103 """
104 client = SerialStudioClient(timeout=5.0)
105
106 try:
107 client.connect()
108 except ConnectionError as e:
109 pytest.skip(f"Server unavailable (may have crashed from previous test): {e}")
110
111 yield client
112
113 # Cleanup - but don't fail if server is unresponsive
114 try:
115 client.disconnect()
116 except Exception:
117 pass
118
119
120@pytest.fixture

Callers

nothing calls this directly

Calls 3

connectMethod · 0.95
disconnectMethod · 0.95
SerialStudioClientClass · 0.90

Tested by

no test coverage detected