Skip to content

Instantly share code, notes, and snippets.

@velotiotech
Created June 9, 2021 12:27
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/404fdf273a1bba6e8dd03bd2deee800e to your computer and use it in GitHub Desktop.
Save velotiotech/404fdf273a1bba6e8dd03bd2deee800e to your computer and use it in GitHub Desktop.
import pytest
from product.models import Category
@pytest.fixture
def category(db) -> Category:
return Category.objects.create(name="Books")
def test_filter_category(category):
assert Category.objects.filter(name="Books").exists()
def test_update_category(category):
category.name = "DVDs"
category.save()
category_from_db = Category.objects.get(name="DVDs")
assert category_from_db.name == "DVDs"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment