Tests and lint pass
This commit is contained in:
parent
0502902ffe
commit
f4ad388e36
7 changed files with 11 additions and 10 deletions
|
|
@ -12,7 +12,6 @@ from common import ProblemDetails
|
|||
from settings import settings
|
||||
from users.models import User
|
||||
from security import JwtConfig, verify_jwt
|
||||
from settings import settings
|
||||
from typing import TypedDict
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@ from __future__ import annotations
|
|||
from typing import List, Optional
|
||||
|
||||
import aiosqlite
|
||||
from fastapi import APIRouter, Depends, Query, Request, Response
|
||||
from fastapi import APIRouter, Depends, Query, Response
|
||||
|
||||
import ingredients as ingredients_mod
|
||||
import recipes
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@ from __future__ import annotations
|
|||
|
||||
from datetime import datetime
|
||||
from enum import Enum
|
||||
from typing import Dict, List, Literal
|
||||
from typing import Dict, List, Literal, cast
|
||||
|
||||
import aiosqlite
|
||||
from fastapi import APIRouter, Depends, Request, Response
|
||||
|
|
@ -109,7 +109,11 @@ def _to_meal_item(item: shopping.ShoppingListItem) -> RequestedMealItem:
|
|||
|
||||
def _to_shopping_list_out(sl: shopping.ShoppingList) -> ShoppingListOut:
|
||||
# Map internal enum value "" to outward-friendly "home"
|
||||
outward_store = "home" if sl.store_name == StoreEnum.home else sl.store_name.value
|
||||
if sl.store_name == StoreEnum.home:
|
||||
outward_store: Literal["woolworths", "coles", "home"] = "home"
|
||||
else:
|
||||
# Remaining enum values are 'woolworths' or 'coles'
|
||||
outward_store = cast(Literal["woolworths", "coles"], sl.store_name.value)
|
||||
return ShoppingListOut(
|
||||
id=sl.id,
|
||||
created_date=sl.created_date,
|
||||
|
|
|
|||
|
|
@ -13,7 +13,6 @@ from api.shopping import (
|
|||
_to_ingredient_item,
|
||||
_to_meal_item,
|
||||
_to_shopping_list_out,
|
||||
IngredientPurchaseItemIn,
|
||||
PurchaseListIn,
|
||||
)
|
||||
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
from typing import ClassVar, Optional
|
||||
from typing import ClassVar
|
||||
|
||||
from common import ApiModel
|
||||
|
||||
|
|
|
|||
2
main.py
2
main.py
|
|
@ -169,7 +169,7 @@ def create_app() -> FastAPI:
|
|||
app.include_router(households_router.router, prefix="/api/v1", tags=["v2"]) # new
|
||||
# Mount household-scoped endpoints
|
||||
try:
|
||||
app.include_router(households_router.scoped, prefix="/api/v1", tags=["v2"]) # type: ignore[attr-defined]
|
||||
app.include_router(households_router.scoped, prefix="/api/v1", tags=["v2"])
|
||||
except Exception:
|
||||
pass
|
||||
app.include_router(recipes_v2_router.router, prefix="/api/v1", tags=["v2"]) # new
|
||||
|
|
|
|||
|
|
@ -39,7 +39,6 @@ class TestAuthAndHouseholdsV2(unittest.IsolatedAsyncioTestCase):
|
|||
# List households (migration created default household 'default' and membership set to admin)
|
||||
r = self.client.get("/api/v1/users/me/households", headers=headers)
|
||||
assert r.status_code == 200, r.text
|
||||
households = r.json()
|
||||
|
||||
# Create a new household
|
||||
r = self.client.post("/api/v1/households", headers=headers, json={"name": "Family"})
|
||||
|
|
|
|||
Loading…
Reference in a new issue