Skip to content

Instantly share code, notes, and snippets.

Created June 9, 2021 12:33
What would you like to do?
import pytest
from product.models import Category, Product, Retail
def retailer_abc(db):
return Retail.objects.create(name="ABC")
def retailers(db) -> list:
return []
def append_retailers(retailers, retailer_abc):
return retailers.append(retailer_abc)
def product_one(db, category, retailers):
product = Product.objects.create(name="Book 1", category=category)
return product
def test_product_retailer(db, retailer_abc, product_one):
assert product_one.retails.filter(
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment