2018-03-04 05:28:04 +00:00
|
|
|
"""Tests for our aiohttp mocker."""
|
|
|
|
import pytest
|
|
|
|
|
2019-12-09 15:52:24 +00:00
|
|
|
from .aiohttp import AiohttpClientMocker
|
|
|
|
|
2018-03-04 05:28:04 +00:00
|
|
|
|
|
|
|
async def test_matching_url():
|
|
|
|
"""Test we can match urls."""
|
|
|
|
mocker = AiohttpClientMocker()
|
2019-07-31 19:25:30 +00:00
|
|
|
mocker.get("http://example.com")
|
|
|
|
await mocker.match_request("get", "http://example.com/")
|
2018-03-04 05:28:04 +00:00
|
|
|
|
|
|
|
mocker.clear_requests()
|
|
|
|
|
|
|
|
with pytest.raises(AssertionError):
|
2019-07-31 19:25:30 +00:00
|
|
|
await mocker.match_request("get", "http://example.com/")
|
2018-03-04 05:28:04 +00:00
|
|
|
|
|
|
|
mocker.clear_requests()
|
|
|
|
|
2019-07-31 19:25:30 +00:00
|
|
|
mocker.get("http://example.com?a=1")
|
|
|
|
await mocker.match_request("get", "http://example.com/", params={"a": 1, "b": 2})
|