Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test: fixed min max products filters tests #93

Merged
merged 1 commit into from
Mar 16, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions Dshop/apps/products_catalogue/tests/test_products_filters.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,19 +91,19 @@ def test_filter_category(client, products):
@pytest.mark.django_db
def test_filter_by_min_price(client, products):
url = reverse("products-list")
response = client.get(f"{url}?prince__gt=5")
response = client.get(f"{url}?price__gt=5")
products = response.context['object_list']
for value in range(5, 10):
assert products[value].price == Decimal(value + 1)
for value, product in enumerate(products, start=6):
assert product.price == value


@pytest.mark.django_db
def test_filter_by_max_price(client, products):
url = reverse("products-list")
response = client.get(f"{url}?prince__lt=5")
response = client.get(f"{url}?price__lt=5")
products = response.context['object_list']
for idx, value in enumerate(range(5)):
assert products[idx].price == Decimal(value + 1)
for value, product in enumerate(products, start=1):
assert product.price == value


@pytest.mark.django_db
Expand Down
Loading