diff options
author | Étienne Loks <etienne.loks@iggdrasil.net> | 2016-09-23 12:27:43 +0200 |
---|---|---|
committer | Étienne Loks <etienne.loks@iggdrasil.net> | 2016-09-23 12:27:43 +0200 |
commit | f5179bad71a5b5e65f70172b177abdcb3896fca2 (patch) | |
tree | 8736f0005a4a2c89d8b8a818a73adc310bb1ea55 /ishtar_common/tests.py | |
parent | 32fbe5ef5c8d0c86e15b7d5fe2881b032cc8af17 (diff) | |
download | Ishtar-f5179bad71a5b5e65f70172b177abdcb3896fca2.tar.bz2 Ishtar-f5179bad71a5b5e65f70172b177abdcb3896fca2.zip |
Cache: manage long keys - immediatly refresh cache after types modifications
Diffstat (limited to 'ishtar_common/tests.py')
-rw-r--r-- | ishtar_common/tests.py | 16 |
1 files changed, 16 insertions, 0 deletions
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): |