コード例 #1
0
ファイル: tests.py プロジェクト: wudan1874/mdai
 def test_cloudfront_validate_distribution_id(self):
     with self.assertRaises(ImproperlyConfigured):
         get_backends(backend_settings={
             'cloudfront': {
                 'BACKEND': 'wagtail.contrib.wagtailfrontendcache.backends.CloudfrontBackend',
             },
         })
コード例 #2
0
ファイル: tests.py プロジェクト: didorothy/wagtail
 def test_cloudfront_validate_distribution_id(self):
     with self.assertRaises(ImproperlyConfigured):
         get_backends(backend_settings={
             'cloudfront': {
                 'BACKEND': 'wagtail.contrib.wagtailfrontendcache.backends.CloudfrontBackend',
             },
         })
コード例 #3
0
ファイル: tests.py プロジェクト: nfletton/wagtail
    def test_backwards_compatibility(self):
        backends = get_backends()

        self.assertEqual(set(backends.keys()), set(["default"]))
        self.assertIsInstance(backends["default"], HTTPBackend)
        self.assertEqual(backends["default"].cache_scheme, "http")
        self.assertEqual(backends["default"].cache_netloc, "localhost:8000")
コード例 #4
0
ファイル: tests.py プロジェクト: emg36/wagtail
    def test_backwards_compatibility(self):
        backends = get_backends()

        self.assertEqual(set(backends.keys()), set(['default']))
        self.assertIsInstance(backends['default'], HTTPBackend)
        self.assertEqual(backends['default'].cache_scheme, 'http')
        self.assertEqual(backends['default'].cache_netloc, 'localhost:8000')
コード例 #5
0
ファイル: tests.py プロジェクト: didorothy/wagtail
    def test_backwards_compatibility(self):
        backends = get_backends()

        self.assertEqual(set(backends.keys()), set(['default']))
        self.assertIsInstance(backends['default'], HTTPBackend)
        self.assertEqual(backends['default'].cache_scheme, 'http')
        self.assertEqual(backends['default'].cache_netloc, 'localhost:8000')
コード例 #6
0
ファイル: tests.py プロジェクト: didorothy/wagtail
    def test_cloudfront(self):
        backends = get_backends(backend_settings={
            'cloudfront': {
                'BACKEND': 'wagtail.contrib.wagtailfrontendcache.backends.CloudfrontBackend',
                'DISTRIBUTION_ID': 'frontend',
            },
        })

        self.assertEqual(set(backends.keys()), set(['cloudfront']))
        self.assertIsInstance(backends['cloudfront'], CloudfrontBackend)

        self.assertEqual(backends['cloudfront'].cloudfront_distribution_id, 'frontend')
コード例 #7
0
ファイル: tests.py プロジェクト: EricSchles/wagtail
    def test_varnish(self):
        backends = get_backends(backend_settings={
            'varnish': {
                'BACKEND': 'wagtail.contrib.wagtailfrontendcache.backends.HTTPBackend',
                'LOCATION': 'http://localhost:8000',
            },
        })

        self.assertEqual(set(backends.keys()), set(['varnish']))
        self.assertIsInstance(backends['varnish'], HTTPBackend)

        self.assertEqual(backends['varnish'].cache_location, 'http://localhost:8000')
コード例 #8
0
ファイル: tests.py プロジェクト: wudan1874/mdai
    def test_cloudfront(self):
        backends = get_backends(backend_settings={
            'cloudfront': {
                'BACKEND': 'wagtail.contrib.wagtailfrontendcache.backends.CloudfrontBackend',
                'DISTRIBUTION_ID': 'frontend',
            },
        })

        self.assertEqual(set(backends.keys()), set(['cloudfront']))
        self.assertIsInstance(backends['cloudfront'], CloudfrontBackend)

        self.assertEqual(backends['cloudfront'].cloudfront_distribution_id, 'frontend')
コード例 #9
0
ファイル: tests.py プロジェクト: wudan1874/mdai
    def test_cloudfront_distribution_id_mapping(self, _create_invalidation):
        backends = get_backends(backend_settings={
            'cloudfront': {
                'BACKEND': 'wagtail.contrib.wagtailfrontendcache.backends.CloudfrontBackend',
                'DISTRIBUTION_ID': {
                    'www.wagtail.io': 'frontend',
                }
            },
        })
        backends.get('cloudfront').purge('http://www.wagtail.io/home/events/christmas/')
        backends.get('cloudfront').purge('http://torchbox.com/blog/')

        _create_invalidation.assert_called_once_with('frontend', ['/home/events/christmas/'])
コード例 #10
0
ファイル: tests.py プロジェクト: wudan1874/mdai
    def test_varnish(self):
        backends = get_backends(backend_settings={
            'varnish': {
                'BACKEND': 'wagtail.contrib.wagtailfrontendcache.backends.HTTPBackend',
                'LOCATION': 'http://localhost:8000',
            },
        })

        self.assertEqual(set(backends.keys()), set(['varnish']))
        self.assertIsInstance(backends['varnish'], HTTPBackend)

        self.assertEqual(backends['varnish'].cache_scheme, 'http')
        self.assertEqual(backends['varnish'].cache_netloc, 'localhost:8000')
コード例 #11
0
ファイル: utils.py プロジェクト: ourrevolution/site-archived
def purge_all_from_cache(backend_settings=None, backends=None):
    """Utility method to purge all from cache, based on 
    wagtail.contrib.wagtailfrontendcache.utils"""

    for backend_name, backend in get_backends(
            backend_settings=backend_settings, backends=backends).items():
        """Check that backend has purge_all implemented"""
        try:
            logger.info("[%s] Purging All", backend_name)
            backend.purge_all()
        except AttributeError:
            logger.error("[%s] Backend does not support purge_all.",
                         backend_name)
コード例 #12
0
ファイル: tests.py プロジェクト: didorothy/wagtail
    def test_cloudfront_distribution_id_mapping(self, _create_invalidation):
        backends = get_backends(backend_settings={
            'cloudfront': {
                'BACKEND': 'wagtail.contrib.wagtailfrontendcache.backends.CloudfrontBackend',
                'DISTRIBUTION_ID': {
                    'www.wagtail.io': 'frontend',
                }
            },
        })
        backends.get('cloudfront').purge('http://www.wagtail.io/home/events/christmas/')
        backends.get('cloudfront').purge('http://torchbox.com/blog/')

        _create_invalidation.assert_called_once_with('frontend', '/home/events/christmas/')
コード例 #13
0
ファイル: tests.py プロジェクト: nfletton/wagtail
    def test_cloudfront_distribution_id_mapping(self, _create_invalidation):
        backends = get_backends(
            backend_settings={
                "cloudfront": {
                    "BACKEND": "wagtail.contrib.wagtailfrontendcache.backends.CloudfrontBackend",
                    "DISTRIBUTION_ID": {"www.wagtail.io": "frontend"},
                }
            }
        )
        backends.get("cloudfront").purge("http://www.wagtail.io/home/events/christmas/")
        backends.get("cloudfront").purge("http://torchbox.com/blog/")

        _create_invalidation.assert_called_once_with("frontend", "/home/events/christmas/")
コード例 #14
0
ファイル: tests.py プロジェクト: EricSchles/wagtail
    def test_cloudflare(self):
        backends = get_backends(backend_settings={
            'cloudflare': {
                'BACKEND': 'wagtail.contrib.wagtailfrontendcache.backends.CloudflareBackend',
                'EMAIL': '*****@*****.**',
                'TOKEN': 'this is the token',
            },
        })

        self.assertEqual(set(backends.keys()), set(['cloudflare']))
        self.assertIsInstance(backends['cloudflare'], CloudflareBackend)

        self.assertEqual(backends['cloudflare'].cloudflare_email, '*****@*****.**')
        self.assertEqual(backends['cloudflare'].cloudflare_token, 'this is the token')
コード例 #15
0
ファイル: tests.py プロジェクト: EricSchles/wagtail
    def test_filter(self):
        backends = get_backends(backend_settings={
            'varnish': {
                'BACKEND': 'wagtail.contrib.wagtailfrontendcache.backends.HTTPBackend',
                'LOCATION': 'http://*****:*****@test.com',
                'TOKEN': 'this is the token',
            }
        }, backends=['cloudflare'])

        self.assertEqual(set(backends.keys()), set(['cloudflare']))
コード例 #16
0
ファイル: tests.py プロジェクト: nfletton/wagtail
    def test_cloudfront(self):
        backends = get_backends(
            backend_settings={
                "cloudfront": {
                    "BACKEND": "wagtail.contrib.wagtailfrontendcache.backends.CloudfrontBackend",
                    "DISTRIBUTION_ID": "frontend",
                }
            }
        )

        self.assertEqual(set(backends.keys()), set(["cloudfront"]))
        self.assertIsInstance(backends["cloudfront"], CloudfrontBackend)

        self.assertEqual(backends["cloudfront"].cloudfront_distribution_id, "frontend")
コード例 #17
0
    def test_multiple(self):
        backends = get_backends(backend_settings={
            'varnish': {
                'BACKEND': 'wagtail.contrib.wagtailfrontendcache.backends.HTTPBackend',
                'LOCATION': 'http://*****:*****@test.com',
                'TOKEN': 'this is the token',
            }
        })

        self.assertEqual(set(backends.keys()), set(['varnish', 'cloudflare']))
コード例 #18
0
    def test_cloudflare(self):
        backends = get_backends(backend_settings={
            'cloudflare': {
                'BACKEND': 'wagtail.contrib.wagtailfrontendcache.backends.CloudflareBackend',
                'EMAIL': '*****@*****.**',
                'TOKEN': 'this is the token',
            },
        })

        self.assertEqual(set(backends.keys()), set(['cloudflare']))
        self.assertIsInstance(backends['cloudflare'], CloudflareBackend)

        self.assertEqual(backends['cloudflare'].cloudflare_email, '*****@*****.**')
        self.assertEqual(backends['cloudflare'].cloudflare_token, 'this is the token')
コード例 #19
0
ファイル: tests.py プロジェクト: nfletton/wagtail
    def test_varnish(self):
        backends = get_backends(
            backend_settings={
                "varnish": {
                    "BACKEND": "wagtail.contrib.wagtailfrontendcache.backends.HTTPBackend",
                    "LOCATION": "http://localhost:8000",
                }
            }
        )

        self.assertEqual(set(backends.keys()), set(["varnish"]))
        self.assertIsInstance(backends["varnish"], HTTPBackend)

        self.assertEqual(backends["varnish"].cache_scheme, "http")
        self.assertEqual(backends["varnish"].cache_netloc, "localhost:8000")
コード例 #20
0
ファイル: tests.py プロジェクト: nfletton/wagtail
    def test_cloudflare(self):
        backends = get_backends(
            backend_settings={
                "cloudflare": {
                    "BACKEND": "wagtail.contrib.wagtailfrontendcache.backends.CloudflareBackend",
                    "EMAIL": "*****@*****.**",
                    "TOKEN": "this is the token",
                }
            }
        )

        self.assertEqual(set(backends.keys()), set(["cloudflare"]))
        self.assertIsInstance(backends["cloudflare"], CloudflareBackend)

        self.assertEqual(backends["cloudflare"].cloudflare_email, "*****@*****.**")
        self.assertEqual(backends["cloudflare"].cloudflare_token, "this is the token")
コード例 #21
0
ファイル: tests.py プロジェクト: nfletton/wagtail
    def test_multiple(self):
        backends = get_backends(
            backend_settings={
                "varnish": {
                    "BACKEND": "wagtail.contrib.wagtailfrontendcache.backends.HTTPBackend",
                    "LOCATION": "http://*****:*****@test.com",
                    "TOKEN": "this is the token",
                },
            }
        )

        self.assertEqual(set(backends.keys()), set(["varnish", "cloudflare"]))
コード例 #22
0
ファイル: tests.py プロジェクト: didorothy/wagtail
    def test_default(self):
        backends = get_backends()

        self.assertEqual(len(backends), 0)
コード例 #23
0
ファイル: tests.py プロジェクト: emg36/wagtail
    def test_default(self):
        backends = get_backends()

        self.assertEqual(len(backends), 0)