mirror of
https://github.com/jazzband/django-authority.git
synced 2026-04-26 01:34:45 +00:00
refs #2: properly tested invalidate_cache
This commit is contained in:
parent
c091a91412
commit
ca3963ea7b
1 changed files with 12 additions and 0 deletions
|
|
@ -175,3 +175,15 @@ class PerformanceTest(TestCase):
|
|||
self.check.has_user_perms('foo', self.user, True, True)
|
||||
self.check.has_user_perms('foo', self.user, True, True)
|
||||
self.check.has_user_perms('foo', self.user, True, True)
|
||||
|
||||
def test_invalidate_cache(self):
|
||||
# Show that calling invalidate_cache will cause extra queries.
|
||||
with self.assertNumQueries(2):
|
||||
self.check.has_user_perms('foo', self.user, True, True)
|
||||
|
||||
# Invalidate the cache to show that a query will be generated when
|
||||
# checking perms again.
|
||||
self.check.invalidate_cache()
|
||||
|
||||
# One query to re generate the cache.
|
||||
self.check.has_user_perms('foo', self.user, True, True)
|
||||
|
|
|
|||
Loading…
Reference in a new issue