MCPcopy
hub / github.com/aio-libs/aiohttp / test_release_close

Method test_release_close

tests/test_connector.py:173–190  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

171 conn.close()
172
173 def test_release_close(self):
174 with self.assertWarns(DeprecationWarning):
175 conn = aiohttp.BaseConnector(share_cookies=True, loop=self.loop)
176 req = unittest.mock.Mock()
177 resp = unittest.mock.Mock()
178 resp.message.should_close = True
179 req.response = resp
180
181 cookies = resp.cookies = http.cookies.SimpleCookie()
182 cookies['c1'] = 'cookie1'
183 cookies['c2'] = 'cookie2'
184
185 tr, proto = unittest.mock.Mock(), unittest.mock.Mock()
186 key = 1
187 conn._acquired[key].add(tr)
188 conn._release(key, req, tr, proto)
189 self.assertFalse(conn._conns)
190 self.assertTrue(tr.close.called)
191
192 def test_get_pop_empty_conns(self):
193 # see issue #473

Callers

nothing calls this directly

Calls 1

_releaseMethod · 0.95

Tested by

no test coverage detected