Open tombulled opened 1 year ago
Ensure neoclient-created clients can be easily mocked for integration tests. E.g. by implementing a MockNeoClient.
MockNeoClient
Note: Can supply httpx.Client an app! (WSGI/ASGI)
httpx.Client
If this is the case, perhaps a real NeoClient instance should be used against a mock server?
NeoClient
Assuming a mock client was to be made, it would likely work a bit like this:
from neoclient import MockNeoClient client = MockNeoClient() @client.get("/greet") def greet(name: str) -> dict: return {"message": name}
In this event, no composition or resolution ever happens. But how would you test middleware etc. :/
Maybe the user must specify their own fake client, which implements the Client interface ((Request, /) -> Response).
Client
(Request, /) -> Response
Provide test utilities from a separate neoclient-test library?
neoclient-test
Ensure neoclient-created clients can be easily mocked for integration tests. E.g. by implementing a
MockNeoClient
.Note: Can supply
httpx.Client
an app! (WSGI/ASGI)If this is the case, perhaps a real
NeoClient
instance should be used against a mock server?Assuming a mock client was to be made, it would likely work a bit like this:
In this event, no composition or resolution ever happens. But how would you test middleware etc. :/
Maybe the user must specify their own fake client, which implements the
Client
interface ((Request, /) -> Response
).