| 459 | self.last_params = params['body'] |
| 460 | |
| 461 | def patch_make_request(self): |
| 462 | # If you do not stop a previously started patch, |
| 463 | # it can never be stopped if you call start() again on the same |
| 464 | # patch again... |
| 465 | # So stop the current patch before calling start() on it again. |
| 466 | if self.make_request_is_patched: |
| 467 | self.make_request_patch.stop() |
| 468 | self.make_request_is_patched = False |
| 469 | make_request_patch = self.make_request_patch.start() |
| 470 | if self.parsed_responses is not None: |
| 471 | make_request_patch.side_effect = self._request_patch_side_effect |
| 472 | else: |
| 473 | make_request_patch.return_value = ( |
| 474 | self.http_response, |
| 475 | self.parsed_response, |
| 476 | ) |
| 477 | self.make_request_is_patched = True |
| 478 | |
| 479 | def _request_patch_side_effect(self, *args, **kwargs): |
| 480 | http_response = self.http_response |