예제 #1
0
    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)
예제 #2
0
파일: view.py 프로젝트: tkmce-mca/SAVIS
    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)
예제 #3
0
파일: urls.py 프로젝트: tkmce-mca/SAVIS
# -*- 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"),
)
예제 #4
0
# -*- 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"),

)
예제 #5
0
 def test_cache_status_noauth(self):
     request = self.get_request("/")
     view = CacheStatusView.as_view()
     response = view(request)
     self.assertEqual(response.status_code, 403)
예제 #6
0
파일: view.py 프로젝트: tkmce-mca/SAVIS
 def test_cache_status_noauth(self):
     request = self.get_request('/')
     view = CacheStatusView.as_view()
     response = view(request)
     self.assertEqual(response.status_code, 403)