File tree Expand file tree Collapse file tree 2 files changed +5
-2
lines changed Expand file tree Collapse file tree 2 files changed +5
-2
lines changed Original file line number Diff line number Diff line change 4
4
from fastapi import FastAPI
5
5
from app .api import users
6
6
7
- log_format = ' %(asctime)s | %(levelname)-8s | %(name)-12s - %(message)s'
7
+ log_format = " %(asctime)s | %(levelname)-8s | %(name)-12s - %(message)s"
8
8
logging .basicConfig (stream = sys .stdout , level = logging .DEBUG , format = log_format )
9
9
10
10
app = FastAPI (title = "Python FastAPI Template" , version = "0.1.0" )
Original file line number Diff line number Diff line change 8
8
async def test_create_user ():
9
9
transport = httpx .ASGITransport (app = app )
10
10
async with httpx .AsyncClient (transport = transport , base_url = "http://test" ) as ac :
11
- response = await ac .post ("/api/v1/users/" , json = {"name" : "Simone" , "email" : "simone@example.com" })
11
+ response = await ac .post (
12
+ "/api/v1/users/" , json = {"name" : "Simone" , "email" : "simone@example.com" }
13
+ )
12
14
assert response .status_code == 200
13
15
data = response .json ()
14
16
assert data ["name" ] == "Simone"
15
17
assert data ["email" ] == "simone@example.com"
16
18
19
+
17
20
@pytest .mark .asyncio
18
21
async def test_get_users ():
19
22
transport = httpx .ASGITransport (app = app )
You can’t perform that action at this time.
0 commit comments