Tests fully pass again

This commit is contained in:
Donkie
2024-05-23 20:13:51 +02:00
parent 535fa40ad2
commit c851950701
5 changed files with 14 additions and 6 deletions

View File

@@ -59,7 +59,10 @@ async def update(
key: Annotated[str, Path(min_length=1, max_length=64, regex="^[a-z0-9_]+$")],
body: ExtraFieldParameters,
) -> Union[list[ExtraField], JSONResponse]:
body_with_key = ExtraField.parse_obj(body.copy(update={"key": key, "entity_type": entity_type}))
dict_body = body.model_dump()
dict_body["key"] = key
dict_body["entity_type"] = entity_type
body_with_key = ExtraField.model_validate(dict_body)
try:
await add_or_update_extra_field(db, entity_type, body_with_key)

View File

@@ -209,7 +209,7 @@ async def create( # noqa: ANN201
try:
validate_extra_field_dict(all_fields, body.extra)
except ValueError as e:
return JSONResponse(status_code=400, content=Message(message=str(e)).dict())
return JSONResponse(status_code=400, content=Message(message=str(e)).model_dump())
db_item = await vendor.create(
db=db,