Created
June 9, 2021 12:27
-
-
Save velotiotech/404fdf273a1bba6e8dd03bd2deee800e to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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