From a1e4defeeb0fc1adde245ec55cbbc0efe6fdab5e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jochen=20Wersd=C3=B6rfer?= Date: Sat, 9 Sep 2023 13:44:13 +0200 Subject: [PATCH] #100 test for use slug instead of tag name fix --- tests/filter_test.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/tests/filter_test.py b/tests/filter_test.py index 8e516bcd..01042f62 100644 --- a/tests/filter_test.py +++ b/tests/filter_test.py @@ -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