Esempio n. 1
0
 def get_cookie_jar(self) -> aiohttp.CookieJar:
     loop = get_running_loop()
     jar = aiohttp.CookieJar(loop=loop, unsafe=True, quote_cookie=self._quote_cookies)
     cookies: Optional[Dict] = self.get_cookies()
     if cookies is not None:
         jar.update_cookies(cookies)
     return jar
Esempio n. 2
0
async def test_get_running_loop_ok(loop) -> None:
    assert helpers.get_running_loop() is loop
Esempio n. 3
0
def test_get_running_loop_not_running(loop) -> None:
    with pytest.raises(
            RuntimeError,
            match="The object should be created within an async function"):
        helpers.get_running_loop()
Esempio n. 4
0
def test_get_running_loop_not_running(loop) -> None:
    with pytest.warns(DeprecationWarning):
        helpers.get_running_loop()
Esempio n. 5
0
async def test_get_running_loop_ok(loop) -> None:
    assert helpers.get_running_loop() is loop
Esempio n. 6
0
def test_get_running_loop_not_running(loop) -> None:
    with pytest.raises(
            RuntimeError,
            match="The object should be created from async function"):
        helpers.get_running_loop()