Created
June 9, 2021 12:30
-
-
Save velotiotech/bdfb6498cd6fb7a5f8a6325934d3f5e4 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import pytest | |
from product.models import Category, Product | |
@pytest.fixture | |
def product_one(db): | |
category = Category.objects.create(name="Books") | |
return Product.objects.create(name="Book 1", category=category) | |
@pytest.fixture | |
def product_two(db): | |
category = Category.objects.create(name="Books") | |
return Product.objects.create(name="Book 2", category=category) | |
def test_two_different_books_create(product_one, product_two): | |
assert product_one.pk != product_two.pk |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment