Changed product classes to contain image_filename instead of URL
This commit is contained in:
parent
de974e76e2
commit
b024d1ba89
3 changed files with 5 additions and 5 deletions
|
|
@ -4,4 +4,4 @@ class Product(BaseModel):
|
|||
name: str
|
||||
price: float
|
||||
barcode: int
|
||||
image_url: HttpUrl
|
||||
image_filename: str
|
||||
|
|
@ -1,9 +1,9 @@
|
|||
from src.classes import product_classes
|
||||
|
||||
apple = product_classes.Product(name="Appel", price=1.0, barcode=1000 , image_url="https://i.etsystatic.com/16348658/r/il/380709/1340147432/il_570xN.1340147432_p3pc.jpg")
|
||||
bubble_tea = product_classes.Product(name="Bubble Tea", price=5.0, barcode=1001 ,image_url="https://uxwing.com/wp-content/themes/uxwing/download/food-and-drinks/bubble-tea-icon.png")
|
||||
pizza = product_classes.Product(name="Pizza", price=3.0, barcode=1000 , image_filename="pizza.svg")
|
||||
banana = product_classes.Product(name="Banana", price=1.0, barcode=1001 ,image_filename="banana.svg")
|
||||
|
||||
product_list = [apple, bubble_tea]
|
||||
product_list = [pizza, banana]
|
||||
|
||||
def get_all_products() -> list[product_classes.Product]:
|
||||
return product_list
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@ client = TestClient(app)
|
|||
def default_product_test(product: product_classes.Product):
|
||||
assert type(product.name) == str
|
||||
assert type(product.price) == float
|
||||
assert validators.url(str(product.image_url))
|
||||
assert type(product.image_filename) == str
|
||||
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue