The code and doctest assertions claim that if a case already exists locally, it won't try to get it from the CAP API.
This doesn't appear to be true. LegalDocument.pull() is always called once https://github.com/harvard-lil/h2o/blob/develop/web/main/views.py#L2618 is hit, and a model instance is always created in memory. It's true that if the case already exists locally and is as recent as the one retrieved from CAP, the new instance is not saved and is just discarded, but this isn't the same as not hitting the API in the first place.
(Maybe this behavior is desired to always get a fresh version of the case, in which case the documentation should be updated.)
This doesn't assert that the API is not called—I'd expect a mocked version of the API call to be checked. Additionally, unless I'm misunderstanding, it seems to assert that a new instance of the case was created, which would appear to be the opposite of what is being tested?
The code and doctest assertions claim that if a case already exists locally, it won't try to get it from the CAP API.
This doesn't appear to be true.
LegalDocument.pull()
is always called once https://github.com/harvard-lil/h2o/blob/develop/web/main/views.py#L2618 is hit, and a model instance is always created in memory. It's true that if the case already exists locally and is as recent as the one retrieved from CAP, the new instance is not saved and is just discarded, but this isn't the same as not hitting the API in the first place.(Maybe this behavior is desired to always get a fresh version of the case, in which case the documentation should be updated.)
Additionally, this statement doesn't appear to match what the test code actually does: https://github.com/harvard-lil/h2o/blob/4549516f9ac5f679563cf8c0ca694ab6209b5a99/web/main/views.py#L2600-L2602
This doesn't assert that the API is not called—I'd expect a mocked version of the API call to be checked. Additionally, unless I'm misunderstanding, it seems to assert that a new instance of the case was created, which would appear to be the opposite of what is being tested?