Mock out the CompletionRequest, replacing the response handler JsonFromFuture with the |response_method| parameter.
( response_method )
| 56 | |
| 57 | @contextlib.contextmanager |
| 58 | def MockResolveRequest( response_method ): |
| 59 | """Mock out the CompletionRequest, replacing the response handler |
| 60 | JsonFromFuture with the |response_method| parameter.""" |
| 61 | |
| 62 | with patch( 'ycm.client.resolve_completion_request.ResolveCompletionRequest.' |
| 63 | 'PostDataToHandlerAsync', |
| 64 | return_value = MagicMock( return_value=True ) ): |
| 65 | |
| 66 | # We set up a fake response. |
| 67 | with patch( 'ycm.client.base_request._JsonFromFuture', |
| 68 | side_effect = response_method ): |
| 69 | yield |
| 70 | |
| 71 | |
| 72 | class CompletionTest( TestCase ): |
no outgoing calls
no test coverage detected