Skip to content

Commit b7ea20d

Browse files
authored
docs: Improve wordings in test docs (#2258)
1 parent 5b11850 commit b7ea20d

File tree

1 file changed

+3
-3
lines changed
  • docs/docs/en/getting-started/subscription

1 file changed

+3
-3
lines changed

docs/docs/en/getting-started/subscription/test.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ This way you can catch any exceptions that occur inside your handler:
117117

118118
### Validates Input
119119

120-
Also, your handler has a mock object to validate your input or call counts.
120+
Also, all handlers in test mode have an extra [`MagicMock`](https://docs.python.org/3/library/unittest.mock.html#unittest.mock.MagicMock){.external-link target="_blank"} object to validate passed arguments and call counts.
121121

122122
=== "AIOKafka"
123123
```python linenums="1" hl_lines="6"
@@ -145,11 +145,11 @@ Also, your handler has a mock object to validate your input or call counts.
145145
```
146146

147147
!!! note
148-
The Handler mock has a not-serialized **JSON** message body. This way you can validate the incoming message view, not python arguments.
148+
The *handle* mock has a raw **JSON** message body. This way you can validate the incoming message itself and not a parsed python arguments.
149149

150150
Thus our example checks not `#!python mock.assert_called_with(name="John", user_id=1)`, but `#!python mock.assert_called_with({ "name": "John", "user_id": 1 })`.
151151

152-
You should be careful with this feature: all mock objects will be cleared when the context manager exits.
152+
Scoping rule: all handles' mock objects will be cleared when the context manager exits.
153153

154154
=== "AIOKafka"
155155
```python linenums="1" hl_lines="6 8"

0 commit comments

Comments
 (0)