Skip to content

Instantly share code, notes, and snippets.

@velotiotech
Created June 9, 2021 12:29
Show Gist options
  • Save velotiotech/0629c74e5665aad72c18b1d83d7a95e8 to your computer and use it in GitHub Desktop.
Save velotiotech/0629c74e5665aad72c18b1d83d7a95e8 to your computer and use it in GitHub Desktop.
import pytest
from product.models import Product
@pytest.fixture(params=("ABC123", "123456", "ABCDEF"))
def product_one(db,request):
return Product.objects.create(name="Book 1",sku=request.param)
def test_product_sku(product_one):
assert all(letter.isalnum() for letter in product_one.sku)
assert len(product_one.sku) == 6
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment