Skip to content

Instantly share code, notes, and snippets.

@velotiotech
Created June 9, 2021 12:30
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save velotiotech/bdfb6498cd6fb7a5f8a6325934d3f5e4 to your computer and use it in GitHub Desktop.
Save velotiotech/bdfb6498cd6fb7a5f8a6325934d3f5e4 to your computer and use it in GitHub Desktop.
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