Allows to install mocks that are reset between tests, see grpc_mockserver.
Definition at line 131 of file __init__.py.
Public Member Functions | |
| None | __init__ (self, *, MockserverSession mockserver_session, bool experimental=False) |
| MockDecorator | __call__ (self, servicer_method) |
| Returns a decorator to mock the specified gRPC service method implementation. | |
| Callable[[str], MockDecorator] | mock_factory (self, servicer_class) |
| Allows to create a fixture as a shorthand for mocking methods of the specified gRPC service. | |
| Servicer | install_servicer (self, Servicer servicer) |
Installs as a mock servicer, the class of which should inherit from a generated *Servicer class. | |
Protected Attributes | |
| _mockserver_session = mockserver_session | |
| None pytest_userver.grpc.Mockserver.__init__ | ( | self, | |
| * | , | ||
| MockserverSession | mockserver_session, | ||
| bool | experimental = False ) |
Initializes Mockserver.
Mockserver is usually obtained from grpc_mockserver. Definition at line 137 of file __init__.py.
| MockDecorator pytest_userver.grpc.Mockserver.__call__ | ( | self, | |
| servicer_method ) |
Returns a decorator to mock the specified gRPC service method implementation.
Example:
Definition at line 150 of file __init__.py.
| Servicer pytest_userver.grpc.Mockserver.install_servicer | ( | self, | |
| Servicer | servicer ) |
Installs as a mock servicer, the class of which should inherit from a generated *Servicer class.
Write a service implementation:
*Servicer classes at once is allowed.Install servicer instance:
Use service mock:
Definition at line 183 of file __init__.py.
| Callable[[str], MockDecorator] pytest_userver.grpc.Mockserver.mock_factory | ( | self, | |
| servicer_class ) |
Allows to create a fixture as a shorthand for mocking methods of the specified gRPC service.
Example:
Definition at line 163 of file __init__.py.
|
protected |
Definition at line 148 of file __init__.py.