From f5179bad71a5b5e65f70172b177abdcb3896fca2 Mon Sep 17 00:00:00 2001 From: Étienne Loks Date: Fri, 23 Sep 2016 12:27:43 +0200 Subject: Cache: manage long keys - immediatly refresh cache after types modifications --- ishtar_common/tests.py | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'ishtar_common/tests.py') diff --git a/ishtar_common/tests.py b/ishtar_common/tests.py index 8c918b5a9..0c4bbda08 100644 --- a/ishtar_common/tests.py +++ b/ishtar_common/tests.py @@ -143,6 +143,7 @@ class WizardTest(object): class CacheTest(TestCase): def testAdd(self): + models.OrganizationType.refresh_cache() cached = models.OrganizationType.get_cache('test') self.assertEqual(cached, None) orga = models.OrganizationType.objects.create( @@ -154,6 +155,21 @@ class CacheTest(TestCase): cached = models.OrganizationType.get_cache('testy') self.assertEqual(cached.pk, orga.pk) + def testList(self): + models.OrganizationType.refresh_cache() + types = models.OrganizationType.get_types() + # only empty + self.assertTrue(len(types), 1) + org = models.OrganizationType.objects.create( + txt_idx='test', label='testy') + types = [ + unicode(lbl) for idx, lbl in models.OrganizationType.get_types()] + self.assertTrue('testy' in types) + org.delete() + types = [ + unicode(lbl) for idx, lbl in models.OrganizationType.get_types()] + self.assertFalse('testy' in types) + class MergeTest(TestCase): def setUp(self): -- cgit v1.2.3