示例#1
0
    def test_url_flatten(self):
        expected_urls_dict = {
            'admin::authGroupAdd': 'admin/auth/group/add/',
            'admin::authGroupChange': 'admin/auth/group/${arg0}/change/',
            'admin::authGroupChangelist': 'admin/auth/group/',
            'admin::authGroupDelete': 'admin/auth/group/${arg0}/delete/',
            'admin::authGroupHistory': 'admin/auth/group/${arg0}/history/',
            'admin::authUserAdd': 'admin/auth/user/add/',
            'admin::authUserChange': 'admin/auth/user/${arg0}/change/',
            'admin::authUserChangelist': 'admin/auth/user/',
            'admin::authUserDelete': 'admin/auth/user/${arg0}/delete/',
            'admin::authUserHistory': 'admin/auth/user/${arg0}/history/',
            'admin::authUserPasswordChange': 'admin/auth/user/${arg0}/password/',
            'admin:appList': 'admin/${app_label}/',
            'admin:index': 'admin/',
            'admin:jsi18n': 'admin/jsi18n/',
            'admin:login': '******',
            'admin:logout': 'admin/logout/',
            'admin:passwordChange': 'admin/password_change/',
            'admin:passwordChangeDone': 'admin/password_change/done/',
            'admin:viewOnSite': 'admin/r/${content_type_id}/${object_id}/',
            'testView': 'test/',
        }

        # Django 1.8 and lower have slightly different admin urls
        if LooseVersion(django.get_version()) < LooseVersion("1.9"):
            expected_urls_dict.update({
                'admin::authGroupChange': 'admin/auth/group/${arg0}/',
                'admin::authUserChange': 'admin/auth/user/${arg0}/',
            })

        self.assertEqual(flatten_urls('example.urls', None), expected_urls_dict)
def constants(context):
    return {
        'EXPRESS_PORT': settings.EXPRESS_PORT,
        'LOGIN_REDIRECT': settings.LOGIN_REDIRECT_URL,
        'APPEND_SLASH': settings.APPEND_SLASH,

        'API_BASE': '%s/api/v1/' % settings.SITE_URL,
        'API': flatten_urls('{{ cookiecutter.repo_name }}.api_urls', '')
    }
示例#3
0
def constants(context):
    return {
        'EXPRESS_PORT': settings.EXPRESS_PORT,
        'WEBPACK_PORT': settings.WEBPACK_PORT,
        'LOGIN_REDIRECT': settings.LOGIN_REDIRECT_URL,
        'APPEND_SLASH': settings.APPEND_SLASH,
        'RAVEN_PUBLIC_DSN': settings.RAVEN_PUBLIC_DSN,
        'RAVEN_FRONTEND_DSN': settings.RAVEN_FRONTEND_DSN,
        'API_BASE': '%s/api/v1/' % settings.SITE_URL,
        'API': flatten_urls('{{ cookiecutter.repo_name }}.api_urls', '')
    }
示例#4
0
 def test_url_flatten_resolver(self):
     self.assertEqual(flatten_urls('example.resolver_urls.urlpatterns', None), {})
示例#5
0
 def test_url_flatten_invalid_conf(self):
     with self.assertRaises(ImproperlyConfigured):
         flatten_urls('example.invalid_urls', None)