|
38 | 38 | from pymongo.cursor import CursorType |
39 | 39 | from pymongo.errors import ConfigurationError, OperationFailure |
40 | 40 | from pymongo.hello import HelloCompat |
41 | | -from pymongo.monitoring import _SENSITIVE_COMMANDS |
| 41 | +from pymongo.monitoring import ( |
| 42 | + _SENSITIVE_COMMANDS, |
| 43 | + ConnectionCheckedInEvent, |
| 44 | + ConnectionCheckedOutEvent, |
| 45 | + ConnectionCheckOutFailedEvent, |
| 46 | + ConnectionCheckOutStartedEvent, |
| 47 | + ConnectionClosedEvent, |
| 48 | + ConnectionCreatedEvent, |
| 49 | + ConnectionReadyEvent, |
| 50 | + PoolClearedEvent, |
| 51 | + PoolClosedEvent, |
| 52 | + PoolCreatedEvent, |
| 53 | + PoolReadyEvent, |
| 54 | +) |
42 | 55 | from pymongo.pool import _CancellationContext, _PoolGeneration |
43 | 56 | from pymongo.read_concern import ReadConcern |
44 | 57 | from pymongo.read_preferences import ReadPreference |
@@ -81,36 +94,47 @@ def wait_for_event(self, event, count): |
81 | 94 |
|
82 | 95 | class CMAPListener(BaseListener, monitoring.ConnectionPoolListener): |
83 | 96 | def connection_created(self, event): |
| 97 | + assert isinstance(event, ConnectionCreatedEvent) |
84 | 98 | self.add_event(event) |
85 | 99 |
|
86 | 100 | def connection_ready(self, event): |
| 101 | + assert isinstance(event, ConnectionReadyEvent) |
87 | 102 | self.add_event(event) |
88 | 103 |
|
89 | 104 | def connection_closed(self, event): |
| 105 | + assert isinstance(event, ConnectionClosedEvent) |
90 | 106 | self.add_event(event) |
91 | 107 |
|
92 | 108 | def connection_check_out_started(self, event): |
| 109 | + assert isinstance(event, ConnectionCheckOutStartedEvent) |
93 | 110 | self.add_event(event) |
94 | 111 |
|
95 | 112 | def connection_check_out_failed(self, event): |
| 113 | + assert isinstance(event, ConnectionCheckOutFailedEvent) |
96 | 114 | self.add_event(event) |
97 | 115 |
|
98 | 116 | def connection_checked_out(self, event): |
| 117 | + assert isinstance(event, ConnectionCheckedOutEvent) |
99 | 118 | self.add_event(event) |
100 | 119 |
|
101 | 120 | def connection_checked_in(self, event): |
| 121 | + assert isinstance(event, ConnectionCheckedInEvent) |
102 | 122 | self.add_event(event) |
103 | 123 |
|
104 | 124 | def pool_created(self, event): |
| 125 | + assert isinstance(event, PoolCreatedEvent) |
105 | 126 | self.add_event(event) |
106 | 127 |
|
107 | 128 | def pool_ready(self, event): |
| 129 | + assert isinstance(event, PoolReadyEvent) |
108 | 130 | self.add_event(event) |
109 | 131 |
|
110 | 132 | def pool_cleared(self, event): |
| 133 | + assert isinstance(event, PoolClearedEvent) |
111 | 134 | self.add_event(event) |
112 | 135 |
|
113 | 136 | def pool_closed(self, event): |
| 137 | + assert isinstance(event, PoolClosedEvent) |
114 | 138 | self.add_event(event) |
115 | 139 |
|
116 | 140 |
|
|
0 commit comments