1111
1212@pytest .fixture
1313def client (event_loop ):
14- client = AsyncClient (app = app , base_url = ' http://test' )
14+ client = AsyncClient (app = app , base_url = " http://test" )
1515 yield client
1616 event_loop .run_until_complete (client .aclose ())
1717
@@ -20,29 +20,29 @@ def client(event_loop):
2020async def test_index (client ):
2121 giphy_client_mock = mock .AsyncMock (spec = GiphyClient )
2222 giphy_client_mock .search .return_value = {
23- ' data' : [
24- {' url' : ' https://giphy.com/gif1.gif' },
25- {' url' : ' https://giphy.com/gif2.gif' },
23+ " data" : [
24+ {" url" : " https://giphy.com/gif1.gif" },
25+ {" url" : " https://giphy.com/gif2.gif" },
2626 ],
2727 }
2828
2929 with app .container .giphy_client .override (giphy_client_mock ):
3030 response = await client .get (
31- '/' ,
31+ "/" ,
3232 params = {
33- ' query' : ' test' ,
34- ' limit' : 10 ,
33+ " query" : " test" ,
34+ " limit" : 10 ,
3535 },
3636 )
3737
3838 assert response .status_code == 200
3939 data = response .json ()
4040 assert data == {
41- ' query' : ' test' ,
42- ' limit' : 10 ,
43- ' gifs' : [
44- {' url' : ' https://giphy.com/gif1.gif' },
45- {' url' : ' https://giphy.com/gif2.gif' },
41+ " query" : " test" ,
42+ " limit" : 10 ,
43+ " gifs" : [
44+ {" url" : " https://giphy.com/gif1.gif" },
45+ {" url" : " https://giphy.com/gif2.gif" },
4646 ],
4747 }
4848
@@ -51,28 +51,28 @@ async def test_index(client):
5151async def test_index_no_data (client ):
5252 giphy_client_mock = mock .AsyncMock (spec = GiphyClient )
5353 giphy_client_mock .search .return_value = {
54- ' data' : [],
54+ " data" : [],
5555 }
5656
5757 with app .container .giphy_client .override (giphy_client_mock ):
58- response = await client .get ('/' )
58+ response = await client .get ("/" )
5959
6060 assert response .status_code == 200
6161 data = response .json ()
62- assert data [' gifs' ] == []
62+ assert data [" gifs" ] == []
6363
6464
6565@pytest .mark .asyncio
6666async def test_index_default_params (client ):
6767 giphy_client_mock = mock .AsyncMock (spec = GiphyClient )
6868 giphy_client_mock .search .return_value = {
69- ' data' : [],
69+ " data" : [],
7070 }
7171
7272 with app .container .giphy_client .override (giphy_client_mock ):
73- response = await client .get ('/' )
73+ response = await client .get ("/" )
7474
7575 assert response .status_code == 200
7676 data = response .json ()
77- assert data [' query' ] == app .container .config .default .query ()
78- assert data [' limit' ] == app .container .config .default .limit ()
77+ assert data [" query" ] == app .container .config .default .query ()
78+ assert data [" limit" ] == app .container .config .default .limit ()
0 commit comments