Skip to content

Instantly share code, notes, and snippets.

@velotiotech
Created June 9, 2021 12:28
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/9f7ebadfb806b79caa906d5f7f4a6c93 to your computer and use it in GitHub Desktop.
Save velotiotech/9f7ebadfb806b79caa906d5f7f4a6c93 to your computer and use it in GitHub Desktop.
import pytest
from product.models import Category, Product
@pytest.fixture
def product_one(db):
return Product.objects.create(name="Book 1", sku="ABC123")
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