You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
As it stands, code built on top of pyscicat can only be tested either against an instance of scicat or by mocking requests. The former is too slow for development. The latter means that you lose the abstraction the client provides because users need to know exactly which requests are made.
For example, let's say we have some code that creates a dataset and datablock. But we don't know (or care) exactly how, in what order, or if it does anything else to scicat. We only care about the fact that at the end, there is a dataset and a datablock in scicat. Currently, we have to test it like this:
client=ScicatClient(...)
dataset= ...
datablock= ....
withrequests_mock.Mocker() asmock_request:
set_up_mock(mock_requests)
a_function_that_uploads_a_dataset(client, dataset, datablock)
# assert that mock_request.request_history contains the correct requests
It is not strictly necessary to support all endpoints in the fake. It would already be useful if it only supports the most common ones.
Downsides:
increased maintainance burden on pyscicat. The fake needs to be kept up to date as well as the actual client
the fake needs to be tested which might be tricky
I think that we need something like this in our code. Otherwise, we cannot really test our usage of pyscicat. It is an option that we develop it entirely on our side. But it would be beneficial to the larger community if the fake was provided by pyscicat itself.
The text was updated successfully, but these errors were encountered:
As it stands, code built on top of pyscicat can only be tested either against an instance of scicat or by mocking
requests
. The former is too slow for development. The latter means that you lose the abstraction the client provides because users need to know exactly which requests are made.For example, let's say we have some code that creates a dataset and datablock. But we don't know (or care) exactly how, in what order, or if it does anything else to scicat. We only care about the fact that at the end, there is a dataset and a datablock in scicat. Currently, we have to test it like this:
A much better solution would be
This is better because:
a_function_that_uploads_a_dataset
changes or it uses different endpoints for some reasonWith the changes in #27,
FakeClient
can be implemented along these lines:It is not strictly necessary to support all endpoints in the fake. It would already be useful if it only supports the most common ones.
Downsides:
I think that we need something like this in our code. Otherwise, we cannot really test our usage of pyscicat. It is an option that we develop it entirely on our side. But it would be beneficial to the larger community if the fake was provided by pyscicat itself.
The text was updated successfully, but these errors were encountered: