Exemplo n.º 1
0
    def test_make_admin_urlpatterns(self):
        # make_admin_urlpatters() result is an iterable of RegexURLResolver
        # objects, although it relies on Django's settings to have been configured.
        try:
            from django.conf.urls import RegexURLResolver
        except ImportError:
            # Django 1.3
            from django.core.urlresolvers import RegexURLResolver

        settings = djangomini.add_custom_app("admin")
        djangomini.configure_settings(settings)
        result = djangomini.make_admin_urlpatterns()

        for pattern in result:
            self.assertTrue(isinstance(pattern, RegexURLResolver))
Exemplo n.º 2
0
 def test_returns_settings(self):
     # add_custom_app() returns the same object if settings != None.
     settings = {}
     result = djangomini.add_custom_app("admin", settings=settings)
     self.assertTrue(result is settings)
Exemplo n.º 3
0
 def test_returns_dict(self):
     # add_custom_app() returns {} if settings is omitted or None.
     result = djangomini.add_custom_app("admin", settings=None)
     self.assertTrue(isinstance(result, dict))
Exemplo n.º 4
0
 def test_debug_toolbar_app(self):
     # django-debug-toolbar
     result = djangomini.add_custom_app("django-debug-toolbar")
     self.assertTrue("debug_toolbar" in result["INSTALLED_APPS"])
Exemplo n.º 5
0
 def test_admin_app(self):
     # django.contrib.admin
     result = djangomini.add_custom_app("admin")
     self.assertTrue("django.contrib.admin" in result["INSTALLED_APPS"])