Пример #1
0
 def test_dispatches_dispatch_raise_404(self):
     self.request.method = 'GET'
     d = dispatch(
         GET=self.view_404
     )
     response = d(self.request)
     self.assertEqual(response.status_code, 404)
Пример #2
0
 def test_dispatches_dispatch_raise_404(self):
     self.request.method = 'GET'
     d = dispatch(
         GET=self.view_404
     )
     response = d(self.request)
     self.assertEqual(response.status_code, 404)
Пример #3
0
 def test_dispatches_dispatch_get_method_not_allowed(self):
     self.request.method = 'GET'
     d = dispatch(
         POST=self.view,
     )
     response = d(self.request)
     self.assertEqual(response.status_code, 405)
Пример #4
0
 def test_dispatches_dispatch_get_method_not_allowed(self):
     self.request.method = 'GET'
     d = dispatch(
         POST=self.view,
     )
     response = d(self.request)
     self.assertEqual(response.status_code, 405)
Пример #5
0
 def test_dispatches_dispatch_get_success(self):
     self.request.method = 'GET'
     d = dispatch(
         GET=self.view,
     )
     response = d(self.request)
     self.view.assert_called_with(self.request)
     self.assertEqual(response, 'view')
Пример #6
0
 def test_dispatches_dispatch_get_success(self):
     self.request.method = 'GET'
     d = dispatch(
         GET=self.view,
     )
     response = d(self.request)
     self.view.assert_called_with(self.request)
     self.assertEqual(response, 'view')
Пример #7
0
from application.views.users import *
from application.views.projects import *
from application.views.issues import *
from application.views.comments import *
from application.views.labels import *


# error handlers
handler403 = permission_denied
handler404 = page_not_found
handler500 = server_error


# routers
urlpatterns = patterns('',
    url(r'^$', dispatch(GET=base_view)),
    url(r'^login$', dispatch(GET=base_view)),


    # /projects/<project_id>
    url(r'^projects/(?P<project_id>[0-9]{1,32})$', api_dispatch(
        GET=base_view,
    )),
    # /projects/<project_id>/labels
    url(r'^projects/(?P<project_id>[0-9]{1,32})/labels$', api_dispatch(
        GET=get_labels,
        POST=add_label,
    )),
    # /projects/<project_id>/labels/<label_id>
    url(r'^projects/(?P<project_id>[0-9]{1,32})/labels/(?P<label_id>[0-9]{1,32})$', api_dispatch(
        PUT=update_label,
Пример #8
0
from application.views.base import base_view
from application.views.settings import *
from application.views.applications import *
from application.views.users import *
from application.views.logs import *


# error handlers
handler403 = permission_denied
handler404 = page_not_found
handler500 = server_error


# routers
urlpatterns = patterns('',
    url(r'^$', dispatch(GET=base_view)),
    url(r'^login$', dispatch(GET=base_view)),

    # /applications
    url(r'^applications$', api_dispatch(
        GET=get_applications,
    )),
    # /applications/<application_id>/logs
    url(r'^applications/(?P<application_id>[0-9]{1,32})/logs$', api_dispatch(
        GET=get_logs,
    )),
    # /applications/<application_id>/logs/<log_id>
    url(r'^applications/(?P<application_id>[0-9]{1,32})/logs/(?P<log_id>[0-9]{1,32})$', api_dispatch(
        GET=get_log,
        PUT=update_log,
    )),