def test_cache_status_staff(self): self.user.user_permissions.add(self.cache_perm) request = self.get_request("/", user=self.user) view = CacheStatusView.as_view() response = view(request) self.assertEqual(response.status_code, 200) self.user.user_permissions.remove(self.cache_perm) request = self.get_request("/", user=self.user) view = CacheStatusView.as_view() response = view(request) self.assertEqual(response.status_code, 403)
def test_cache_status_staff(self): self.user.user_permissions.add(self.cache_perm) request = self.get_request('/', user=self.user) view = CacheStatusView.as_view() response = view(request) self.assertEqual(response.status_code, 200) self.user.user_permissions.remove(self.cache_perm) request = self.get_request('/', user=self.user) view = CacheStatusView.as_view() response = view(request) self.assertEqual(response.status_code, 403)
# -*- coding: utf-8 -*- from django.conf.urls import url, patterns from django.views.decorators.cache import never_cache from html5_appcache.views import (ManifestAppCache, CacheStatusView, ManifestUpdateView) urlpatterns = patterns( '', url("^manifest.appcache$", never_cache(ManifestAppCache.as_view()), name="appcache_manifest"), url("^manifest/empty.appcache$", never_cache(ManifestAppCache.as_view(force_empty_manifest=1)), name="appcache_manifest_empty"), url("^manifest/(?P<parameter>\w+).appcache$", never_cache(ManifestAppCache.as_view()), name="appcache_manifest"), #This views is used when updating the manifest. ``appcache_update`` parameter #triggers the middleware url("^manifest.appcache/appcache_update/$", never_cache(ManifestAppCache.as_view(appcache_update=1)), name="appcache_manifest_update"), url("^manifest.appcache/appcache_update/ajax/$", never_cache(ManifestUpdateView.as_view(appcache_update=1)), name="appcache_manifest_update_ajax"), url("^manifest.appcache/status/$", never_cache(CacheStatusView.as_view()), name="appcache_manifest_status"), )
# -*- coding: utf-8 -*- from django.conf.urls import url, patterns from django.views.decorators.cache import never_cache from html5_appcache.views import (ManifestAppCache, CacheStatusView, ManifestUpdateView) urlpatterns = patterns('', url("^manifest.appcache$", never_cache(ManifestAppCache.as_view()), name="appcache_manifest"), url("^manifest/empty.appcache$", never_cache(ManifestAppCache.as_view(force_empty_manifest=1)), name="appcache_manifest_empty"), url("^manifest/(?P<parameter>\w+).appcache$", never_cache(ManifestAppCache.as_view()), name="appcache_manifest"), #This views is used when updating the manifest. ``appcache_update`` parameter #triggers the middleware url("^manifest.appcache/appcache_update/$", never_cache(ManifestAppCache.as_view(appcache_update=1)), name="appcache_manifest_update"), url("^manifest.appcache/appcache_update/ajax/$", never_cache(ManifestUpdateView.as_view(appcache_update=1)), name="appcache_manifest_update_ajax"), url("^manifest.appcache/status/$", never_cache(CacheStatusView.as_view()), name="appcache_manifest_status"), )
def test_cache_status_noauth(self): request = self.get_request("/") view = CacheStatusView.as_view() response = view(request) self.assertEqual(response.status_code, 403)
def test_cache_status_noauth(self): request = self.get_request('/') view = CacheStatusView.as_view() response = view(request) self.assertEqual(response.status_code, 403)