コード例 #1
0
 def test_delete_if_cache_disabled(self):
     # As above, but without the cache checks
     self.assertEqual(SiteConfiguration.objects.count(), 0)
     one_cfg = SiteConfiguration.get_solo()
     one_cfg.site_name = 'TEST (uncached) SITE PLEASE IGNORE'
     one_cfg.save()
     self.assertEqual(SiteConfiguration.objects.count(), 1)
     one_cfg.delete()
     self.assertEqual(SiteConfiguration.objects.count(), 0)
     self.assertEqual(SiteConfiguration.get_solo().site_name, 'Default Config')
コード例 #2
0
ファイル: tests.py プロジェクト: vparitskiy/django-solo
 def test_delete_if_cache_disabled(self):
     # As above, but without the cache checks
     self.assertEqual(SiteConfiguration.objects.count(), 0)
     one_cfg = SiteConfiguration.get_solo()
     one_cfg.site_name = 'TEST (uncached) SITE PLEASE IGNORE'
     one_cfg.save()
     self.assertEqual(SiteConfiguration.objects.count(), 1)
     one_cfg.delete()
     self.assertEqual(SiteConfiguration.objects.count(), 0)
     self.assertEqual(SiteConfiguration.get_solo().site_name, 'Default Config')
コード例 #3
0
ファイル: tests.py プロジェクト: vparitskiy/django-solo
    def test_delete_if_cache_enabled(self):
        self.assertEqual(SiteConfiguration.objects.count(), 0)
        self.assertIsNone(self.cache.get(self.cache_key))

        one_cfg = SiteConfiguration.get_solo()
        one_cfg.site_name = 'TEST SITE PLEASE IGNORE'
        one_cfg.save()
        self.assertEqual(SiteConfiguration.objects.count(), 1)
        self.assertIsNotNone(self.cache.get(self.cache_key))

        one_cfg.delete()
        self.assertEqual(SiteConfiguration.objects.count(), 0)
        self.assertIsNone(self.cache.get(self.cache_key))
        self.assertEqual(SiteConfiguration.get_solo().site_name, 'Default Config')
コード例 #4
0
    def test_delete_if_cache_enabled(self):
        self.assertEqual(SiteConfiguration.objects.count(), 0)
        self.assertIsNone(self.cache.get(self.cache_key))

        one_cfg = SiteConfiguration.get_solo()
        one_cfg.site_name = 'TEST SITE PLEASE IGNORE'
        one_cfg.save()
        self.assertEqual(SiteConfiguration.objects.count(), 1)
        self.assertIsNotNone(self.cache.get(self.cache_key))

        one_cfg.delete()
        self.assertEqual(SiteConfiguration.objects.count(), 0)
        self.assertIsNone(self.cache.get(self.cache_key))
        self.assertEqual(SiteConfiguration.get_solo().site_name, 'Default Config')
コード例 #5
0
 def setUp(self):
     self.template = Template(
         '{% load solo_tags %}'
         '{% get_solo "tests.SiteConfiguration" as site_config  %}'
         '{{ site_config.site_name }}')
     self.cache = get_cache('default')
     self.cache_key = SiteConfiguration.get_cache_key()
     self.cache.clear()
     SiteConfiguration.objects.all().delete()
コード例 #6
0
ファイル: tests.py プロジェクト: Rub3nC/django-solo
 def setUp(self):
     self.template = Template(
         '{% load solo_tags %}'
         '{% get_solo "tests.SiteConfiguration" as site_config  %}'
         '{{ site_config.site_name }}'
     )
     self.cache = get_cache('default')
     self.cache_key = SiteConfiguration.get_cache_key()
     self.cache.clear()
     SiteConfiguration.objects.all().delete()
コード例 #7
0
ファイル: tests.py プロジェクト: vparitskiy/django-solo
 def test_cache_prefix_overriding(self):
     key = SiteConfiguration.get_cache_key()
     prefix = key.partition(':')[0]
     self.assertEqual(prefix, 'other')
コード例 #8
0
ファイル: tests.py プロジェクト: lazybird/django-solo
 def test_cache_prefix_overriding(self):
     key = SiteConfiguration.get_cache_key()
     prefix = key.partition(':')[0]
     self.assertEqual(prefix, 'other')