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
If there is a class where every test may wish to use the `json_asserter`, than it may be easier to use to the `JsonAsserterMixin` found in `shipchain_common.test_utils`.
191
191
This will automatically add the `json_asserter` and set it as a class attribute before the tests are run.
192
192
This allows you to just call `self.json_asserter`, allowing for cleaner unit tests imports.
193
+
194
+
195
+
### HTTPrettyAsserter Usage
196
+
197
+
When mocking calls, this can help in ensuring all calls, and only those, were made as expected, with the desired parameters.
198
+
In order to use, simply import the HTTPrettyAsserter from test_utils and use it in place of the usual httpretty:
199
+
```python
200
+
@pytest.yield_fixture
201
+
defmodified_http_pretty():
202
+
HTTPrettyAsserter.enable(allow_net_connect=False)
203
+
yield HTTPrettyAsserter
204
+
HTTPrettyAsserter.disable()
205
+
```
206
+
207
+
Then, you just need to register the uris for the calls you want to mock, and ensure that it is returned in the mocking:
0 commit comments