Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pdct 312 Added endpoint for creating events #24

Merged
merged 17 commits into from
Oct 18, 2023
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions unit_tests/routers/test_event.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
from fastapi import status
from fastapi.encoders import jsonable_encoder
katybaulch marked this conversation as resolved.
Show resolved Hide resolved
from fastapi.testclient import TestClient
import app.service.event as event_service

Expand Down Expand Up @@ -58,7 +59,9 @@ def test_search_when_not_found(

def test_create_when_ok(client: TestClient, event_service_mock, user_header_token):
new_data = create_event_create_dto("event1").model_dump()
response = client.post("/api/v1/events", json=new_data, headers=user_header_token)
response = client.post(
"/api/v1/events", json=jsonable_encoder(new_data), headers=user_header_token
)
assert response.status_code == status.HTTP_201_CREATED
data = response.json()
assert data == "new.event.id.0"
Expand All @@ -71,7 +74,7 @@ def test_create_when_family_not_found(
event_service_mock.missing = True
new_data = create_event_create_dto("this_family")
response = client.post(
"/api/v1/events", json=new_data.model_dump(), headers=user_header_token
"/api/v1/events", json=jsonable_encoder(new_data), headers=user_header_token
)
assert response.status_code == status.HTTP_400_BAD_REQUEST
data = response.json()
Expand Down