示例#1
0
# Copyright 2014 mysqlapi authors. All rights reserved.
# Use of this source code is governed by a BSD-style
# license that can be found in the LICENSE file.

from django.conf.urls import patterns, url

from mysqlapi.api.decorators import basic_auth_required
from mysqlapi.api.views import (BindApp, BindUnit, CreateDatabase,
                                DropDatabase, Healthcheck)

urlpatterns = patterns(
    '',
    url(r'^resources$', basic_auth_required(CreateDatabase.as_view())),
    url(r'^resources/(?P<name>[\w-]+)$',
        basic_auth_required(DropDatabase.as_view())),
    url(r'^resources/(?P<name>[\w-]+)/bind$',
        basic_auth_required(BindUnit.as_view())),
    url(r'^resources/(?P<name>[\w-]+)/bind-app$',
        basic_auth_required(BindApp.as_view())),
    url(r'^resources/(?P<name>[\w-]+)/export$', 'mysqlapi.api.views.export'),
    url(r'^resources/(?P<name>[\w-]+)/status$',
        basic_auth_required(Healthcheck.as_view())),
)
示例#2
0
 def test_post(self):
     request = RequestFactory().post("/")
     response = BindUnit.as_view()(request, "name")
     self.assertEqual(201, response.status_code)
示例#3
0
 def test_delete(self):
     request = RequestFactory().delete("/")
     response = BindUnit.as_view()(request, "name")
     self.assertEqual(200, response.status_code)
示例#4
0
# Copyright 2014 mysqlapi authors. All rights reserved.
# Use of this source code is governed by a BSD-style
# license that can be found in the LICENSE file.

from django.conf.urls import patterns, url

from mysqlapi.api.decorators import basic_auth_required
from mysqlapi.api.views import (BindApp, BindUnit, CreateDatabase,
                                DropDatabase, Healthcheck)

urlpatterns = patterns('',
                       url(r'^resources$',
                           basic_auth_required(CreateDatabase.as_view())),
                       url(r'^resources/(?P<name>[\w-]+)$',
                           basic_auth_required(DropDatabase.as_view())),
                       url(r'^resources/(?P<name>[\w-]+)/bind$',
                           basic_auth_required(BindUnit.as_view())),
                       url(r'^resources/(?P<name>[\w-]+)/bind-app$',
                           basic_auth_required(BindApp.as_view())),
                       url(r'^resources/(?P<name>[\w-]+)/export$',
                           'mysqlapi.api.views.export'),
                       url(r'^resources/(?P<name>[\w-]+)/status$',
                           basic_auth_required(Healthcheck.as_view())),
                       )