Skip to content

Commit 132a2f3

Browse files
committed
Allow replacing existing mocks
1 parent d9e1570 commit 132a2f3

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

src/shipchain_common/test_utils/httpretty_asserter.py

+6-2
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,12 @@ def register_uri(self, # noqa
3636
match_querystring=False,
3737
**headers
3838
):
39-
self.mock.add(method=method, url=uri, body=body, status=status,
40-
adding_headers=adding_headers, match_querystring=match_querystring, headers=headers)
39+
try:
40+
self.mock.replace(method_or_response=method, url=uri, body=body, status=status,
41+
match_querystring=match_querystring, headers=headers)
42+
except ValueError:
43+
self.mock.add(method=method, url=uri, body=body, status=status,
44+
adding_headers=adding_headers, match_querystring=match_querystring, headers=headers)
4145

4246
@property
4347
def latest_requests(self):

0 commit comments

Comments
 (0)