Skip to content

Commit

Permalink
Added a few unit tests for fast_api
Browse files Browse the repository at this point in the history
  • Loading branch information
alexcottner committed Apr 24, 2024
1 parent 3af025a commit 35008c5
Showing 1 changed file with 47 additions and 0 deletions.
47 changes: 47 additions & 0 deletions tests/fastapi/test_fastapi.py
Original file line number Diff line number Diff line change
Expand Up @@ -194,6 +194,53 @@ def return_error():
},
}

def test_heartbeat_sync(client):
@checks.register
def sync_ok():
return []

response = client.get("/__heartbeat__")
assert response.status_code == 200
assert response.json() == {
"status": "ok",
"checks": {"sync_ok": "ok"},
"details": {},
}


def test_heartbeat_async(client):
@checks.register
def async_ok():
return []

response = client.get("/__heartbeat__")
assert response.status_code == 200
assert response.json() == {
"status": "ok",
"checks": {"async_ok": "ok"},
"details": {},
}


def test_heartbeat_mixed_sync(client):
@checks.register
def sync_ok():
return []
@checks.register
def async_ok():
return []

response = client.get("/__heartbeat__")
assert response.status_code == 200
assert response.json() == {
"status": "ok",
"checks": {
"sync_ok": "ok",
"async_ok": "ok",
},
"details": {},
}


def test_heartbeat_head(client):
@checks.register
Expand Down

0 comments on commit 35008c5

Please sign in to comment.