Skip to content

Commit

Permalink
test
Browse files Browse the repository at this point in the history
  • Loading branch information
nik-418 committed Oct 18, 2023
1 parent ecbeeda commit f24e233
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions tests/test_endpoints.py
Original file line number Diff line number Diff line change
Expand Up @@ -175,3 +175,25 @@ def wait_for_background_task():
assert order_of_execution_queue.get() == "send_background_task"
assert order_of_execution_queue.get() == "background_task_completed"

def test_warmup():
app = potassium.Potassium("my_app")

@app.init
def init():
return {}

@app.handler()
def handler(context: dict, request: potassium.Request) -> potassium.Response:
raise Exception("should not be called")

client = app.test_client()

# POST
res = client.post("/_k/warmup", json={})
assert res.status_code == 200
assert res.json == {"warm": True}

# GET
res = client.get("/_k/warmup", json={})
assert res.status_code == 200
assert res.json == {"warm": True}

0 comments on commit f24e233

Please sign in to comment.