Skip to content

Commit

Permalink
fix flaky test ordering (#2427)
Browse files Browse the repository at this point in the history
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
  • Loading branch information
cp-at-mit and pre-commit-ci[bot] authored Oct 24, 2024
1 parent ebf16af commit 367adc9
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions ecommerce/models_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -283,11 +283,13 @@ def test_product_managers():
"""Test that the default manager returns only active products and the 'all_objects' manager returns all the
products
"""
in_active_products = ProductFactory.create_batch(3, is_active=False)
inactive_products = ProductFactory.create_batch(3, is_active=False)
active_products = ProductFactory.create_batch(2, is_active=True)

assert list(Product.objects.all()) == active_products
assert list(Product.all_objects.all()) == in_active_products + active_products
assert list(Product.objects.all().order_by("id")) == list(active_products)
assert list(Product.all_objects.all().order_by("id")) == list(
inactive_products + active_products
)


def test_product_multiple_active_for_single_purchasable_object():
Expand Down

0 comments on commit 367adc9

Please sign in to comment.