Skip to content

Commit

Permalink
Fix ProductionRun API schema after renaming Appliance to Machine. (#42)
Browse files Browse the repository at this point in the history
This fixes a regression introduced by #37. Closes #41.
  • Loading branch information
daniel-k authored Feb 20, 2024
1 parent 1f5fc38 commit fcce1e7
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
4 changes: 3 additions & 1 deletion src/enlyze/api_clients/production_runs/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
from typing import Any, Optional
from uuid import UUID

from pydantic import Field

import enlyze.models as user_models
from enlyze.api_clients.base import ApiBaseModel

Expand Down Expand Up @@ -66,7 +68,7 @@ class Machine(ApiBaseModel):

class ProductionRun(ProductionRunsApiModel):
uuid: UUID
machine: Machine
machine: Machine = Field(alias="appliance")
average_throughput: Optional[float]
production_order: str
product: Product
Expand Down
4 changes: 2 additions & 2 deletions tests/enlyze/test_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@
uuid=st.uuids(),
start=datetime_before_today_strategy,
end=datetime_today_until_now_strategy,
machine=st.builds(
appliance=st.builds(
production_runs_api_models.Machine, uuid=st.just(APPLIANCE_UUID)
),
product=st.builds(
Expand Down Expand Up @@ -435,7 +435,7 @@ def test_get_production_runs(
)
production_runs_api_mock.get("production-runs").mock(
PaginatedProductionRunsApiResponse(
data=[p.model_dump() for p in production_runs]
data=[p.model_dump(by_alias=True) for p in production_runs]
)
)

Expand Down

0 comments on commit fcce1e7

Please sign in to comment.