Skip to content

Commit

Permalink
#100 test for use slug instead of tag name fix
Browse files Browse the repository at this point in the history
  • Loading branch information
ephes committed Sep 9, 2023
1 parent 1fce8c5 commit a1e4def
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion tests/filter_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -184,9 +184,13 @@ def test_posts_are_filtered_by_tag_facet(self, post, another_post):
# given a queryset with a tagged post and another post without this tag
post.tags.add("tag")
post.save()
# use a tag where name and slug are different to test that the slug is used
[tag] = post.tags.all()
tag.slug = "foobar"
tag.save()
# when the posts are filtered by the tag
queryset = post.blog.unfiltered_published_posts
querydict = QueryDict("tag_facets=tag")
querydict = QueryDict(f"tag_facets={tag.slug}")
filterset = PostFilterset(querydict, queryset=queryset)
# then the untagged post is not in the queryset
assert another_post not in filterset.qs
Expand Down

0 comments on commit a1e4def

Please sign in to comment.