-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathconftest.py
96 lines (72 loc) · 2.04 KB
/
conftest.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
from datetime import datetime
import pytest
from pytest_factoryboy import register
from tests.factories import (
AddressFactory,
CategoryFactory,
CouponFactory,
CustomerFactory,
ProductFactory,
ProductRatingFactory,
ProductSpecificationsFactory,
StorageFactory,
ProductsOfTheDayFactory
)
register(CustomerFactory)
register(AddressFactory)
register(CategoryFactory)
register(ProductFactory)
register(ProductRatingFactory)
register(CustomerFactory)
register(ProductSpecificationsFactory)
register(CouponFactory)
register(StorageFactory)
register(ProductsOfTheDayFactory)
# Accounts
@pytest.fixture
def customer(db, customer_factory):
new_customer = customer_factory.create()
return new_customer
@pytest.fixture
def admin_customer(db, customer_factory):
new_customer = customer_factory.create(
email="[email protected]",
full_name="new_admin",
is_staff=True,
is_superuser=True,
)
return new_customer
@pytest.fixture
def address(db, address_factory):
address = address_factory.create()
return address
# Store
@pytest.fixture
def product_category(db, category_factory):
category = category_factory.create()
return category
@pytest.fixture
def product(db, product_factory):
product = product_factory.create()
return product
@pytest.fixture
def product_rating(db, product_rating_factory):
product_rating = product_rating_factory.create()
return product_rating
@pytest.fixture
def product_specifications(db, product_specifications_factory):
product_specification = product_specifications_factory.create()
return product_specification
@pytest.fixture
def coupon(db, coupon_factory):
coupon = coupon_factory.create()
return coupon
@pytest.fixture
def storage(db, storage_factory):
storage = storage_factory.create()
return storage
@pytest.fixture
def products_of_the_day(db, products_of_the_day_factory):
products_of_the_day = products_of_the_day_factory.create()
products_of_the_day.save()
return products_of_the_day