Add mock mode for ConfigClient#195
Conversation
|
@DominicOram thanks for the review for my dodal change DiamondLightSource/dodal#2099. I agree with your points. However, I felt as though I was fighting the design of the |
jacob720
left a comment
There was a problem hiding this comment.
Echoing my comments on the dodal PR, I don't think we should add behaviour to do conversion into a mock client. The client receives converted data from the server, and any test data in dodal/ixx-bluesky repos should emulate the responses we get from the server, not the original config files.
I think instead of baking in server behaviour to the client, in tests we should either:
- mock responses from the server.
- directly mock the result of
get_file_contentsinstead of forcing the behaviour of reading the file system,model_validateing and returning the result.
Probably we will want to do both in different places.
I agree that a framework to make this easy and consistent would be nice
| if the config file isn't in the FILE_TO_CONVERTER_MAP at all. This | ||
| should only be used for testing or when waiting on a release that will | ||
| add the file to the FILE_TO_CONVERTER_MAP. |
There was a problem hiding this comment.
Why have you removed these lines from the docstring? I think they still apply
After discussing IRL, I understand what you mean now and implemented this. I've adjust the code, tests and docs to reflect this. So now the mock client only mocks the server response and doesn't try to implement server conversion logic. Instead, we just provide optional configuration of the path with the associated data we should get back when in mock mode. Please take another look and review. Thanks! |
Fixes #194