Skip to content

Commit

Permalink
Suor#407 failing test to demonstrate a bug
Browse files Browse the repository at this point in the history
  • Loading branch information
tumb1er committed Aug 16, 2021
1 parent e2f60db commit 8424c10
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions tests/tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -660,6 +660,21 @@ def test_387(self):
post = Post.objects.defer("visible").last()
post.delete()

def test_407(self):
brand = Brand.objects.create()
pk = brand.pk
label = Label.objects.create()
brand.labels.set([label])
# Caching
assert len(list(brand.labels.cache()._clone())) == 1

brand.delete()
# Invalidation expected after deletionn
brand = Brand.objects.create(pk=pk)

with self.assertNumQueries(1):
self.assertEqual(len(list(brand.labels.cache()._clone())), 0)


class RelatedTests(BaseTestCase):
fixtures = ['basic']
Expand Down

0 comments on commit 8424c10

Please sign in to comment.