|
| 1 | +import pytest |
| 2 | +from products.models import Product |
| 3 | +from products.enums import ProductType |
| 4 | + |
| 5 | + |
| 6 | +@pytest.fixture(scope="session") |
| 7 | +def available_food_product(django_db_setup, django_db_blocker, approved_restaurant) -> Product: |
| 8 | + with django_db_blocker.unblock(): |
| 9 | + yield Product.objects.create( |
| 10 | + restaurant=approved_restaurant, |
| 11 | + name="Available Food Product", |
| 12 | + description="Available Food Product Description", |
| 13 | + price=10.00, |
| 14 | + quantity=10, |
| 15 | + max_quantity_per_order=5, |
| 16 | + type=ProductType.FOOD, |
| 17 | + ) |
| 18 | + |
| 19 | + |
| 20 | +@pytest.fixture(scope="session") |
| 21 | +def unavailable_food_product(django_db_setup, django_db_blocker, approved_restaurant) -> Product: |
| 22 | + with django_db_blocker.unblock(): |
| 23 | + yield Product.objects.create( |
| 24 | + restaurant=approved_restaurant, |
| 25 | + name="Unavailable Food Product", |
| 26 | + description="Unavailable Food Product Description", |
| 27 | + price=10.00, |
| 28 | + quantity=0, |
| 29 | + max_quantity_per_order=5, |
| 30 | + type=ProductType.FOOD, |
| 31 | + ) |
| 32 | + |
| 33 | + |
| 34 | +@pytest.fixture(scope="session") |
| 35 | +def available_drink_product(django_db_setup, django_db_blocker, approved_restaurant) -> Product: |
| 36 | + with django_db_blocker.unblock(): |
| 37 | + yield Product.objects.create( |
| 38 | + restaurant=approved_restaurant, |
| 39 | + name="Available Drink Product", |
| 40 | + description="Available Drink Product Description", |
| 41 | + price=5.00, |
| 42 | + quantity=10, |
| 43 | + max_quantity_per_order=5, |
| 44 | + type=ProductType.DRINK, |
| 45 | + ) |
| 46 | + |
| 47 | + |
| 48 | +@pytest.fixture(scope="session") |
| 49 | +def unavailable_drink_product(django_db_setup, django_db_blocker, approved_restaurant) -> Product: |
| 50 | + with django_db_blocker.unblock(): |
| 51 | + yield Product.objects.create( |
| 52 | + restaurant=approved_restaurant, |
| 53 | + name="Unavailable Drink Product", |
| 54 | + description="Unavailable Drink Product Description", |
| 55 | + price=5.00, |
| 56 | + quantity=0, |
| 57 | + max_quantity_per_order=5, |
| 58 | + type=ProductType.DRINK, |
| 59 | + ) |
| 60 | + |
| 61 | + |
| 62 | +@pytest.fixture(scope="session") |
| 63 | +def available_salad_product(django_db_setup, django_db_blocker, approved_restaurant) -> Product: |
| 64 | + with django_db_blocker.unblock(): |
| 65 | + yield Product.objects.create( |
| 66 | + restaurant=approved_restaurant, |
| 67 | + name="Available Salad Product", |
| 68 | + description="Available Salad Product Description", |
| 69 | + price=7.50, |
| 70 | + quantity=10, |
| 71 | + max_quantity_per_order=5, |
| 72 | + type=ProductType.SALAD, |
| 73 | + ) |
| 74 | + |
| 75 | + |
| 76 | +@pytest.fixture(scope="session") |
| 77 | +def unavailable_salad_product(django_db_setup, django_db_blocker, approved_restaurant) -> Product: |
| 78 | + with django_db_blocker.unblock(): |
| 79 | + yield Product.objects.create( |
| 80 | + restaurant=approved_restaurant, |
| 81 | + name="Unavailable Salad Product", |
| 82 | + description="Unavailable Salad Product Description", |
| 83 | + price=7.50, |
| 84 | + quantity=0, |
| 85 | + max_quantity_per_order=5, |
| 86 | + type=ProductType.SALAD, |
| 87 | + ) |
| 88 | + |
| 89 | + |
| 90 | +@pytest.fixture(scope="session") |
| 91 | +def available_other_product(django_db_setup, django_db_blocker, approved_restaurant) -> Product: |
| 92 | + with django_db_blocker.unblock(): |
| 93 | + yield Product.objects.create( |
| 94 | + restaurant=approved_restaurant, |
| 95 | + name="Available Coffee Product", |
| 96 | + description="Available Coffee Product Description", |
| 97 | + price=3.50, |
| 98 | + quantity=10, |
| 99 | + max_quantity_per_order=5, |
| 100 | + type=ProductType.OTHER, |
| 101 | + ) |
| 102 | + |
| 103 | + |
| 104 | +@pytest.fixture(scope="session") |
| 105 | +def unavailable_other_product(django_db_setup, django_db_blocker, approved_restaurant) -> Product: |
| 106 | + with django_db_blocker.unblock(): |
| 107 | + yield Product.objects.create( |
| 108 | + restaurant=approved_restaurant, |
| 109 | + name="Unavailable Coffee Product", |
| 110 | + description="Unavailable Coffee Product Description", |
| 111 | + price=3.50, |
| 112 | + quantity=0, |
| 113 | + max_quantity_per_order=5, |
| 114 | + type=ProductType.OTHER, |
| 115 | + ) |
| 116 | + |
| 117 | + |
| 118 | +@pytest.fixture(scope="session") |
| 119 | +def available_food_to_delete(django_db_setup, django_db_blocker, approved_restaurant) -> Product: |
| 120 | + with django_db_blocker.unblock(): |
| 121 | + yield Product.objects.create( |
| 122 | + restaurant=approved_restaurant, |
| 123 | + name="Available Food Product", |
| 124 | + description="Available Food Product Description", |
| 125 | + price=10.00, |
| 126 | + quantity=10, |
| 127 | + max_quantity_per_order=5, |
| 128 | + type=ProductType.FOOD, |
| 129 | + ) |
0 commit comments