Skip to content

Commit

Permalink
Fix post_categories tests
Browse files Browse the repository at this point in the history
  • Loading branch information
stuartmaxwell committed May 29, 2024
1 parent 4763945 commit 18c4f12
Showing 1 changed file with 24 additions and 1 deletion.
25 changes: 24 additions & 1 deletion tests/test_djpress_tags.py
Original file line number Diff line number Diff line change
Expand Up @@ -375,11 +375,34 @@ def test_category_name_no_category():
def test_post_categories(create_test_post):
context = Context({"post": create_test_post})

categories = create_test_post.categories.all()
output = '<ul><li><a href="/category/general/" title="View all posts in the General category">General</a></li></ul>'
assert djpress_tags.post_categories(context) == output


def test_post_categories_none_post_context():
context = Context({"post": None})

output = ""
assert djpress_tags.post_categories(context) == output


def test_post_categories_no_post_context():
context = Context({"foo": None})

output = ""
assert djpress_tags.post_categories(context) == output


@pytest.mark.django_db
def test_post_categories_no_categories_context(create_test_post):
create_test_post.categories.clear()
context = Context({"post": create_test_post})

print(create_test_post)
output = ""
assert djpress_tags.post_categories(context) == output


@pytest.mark.django_db
def test_post_categories_ul(create_test_post):
context = Context({"post": create_test_post})
Expand Down

0 comments on commit 18c4f12

Please sign in to comment.