示例#1
0
    def test_main_admin2(self, execute_from_command_line, import_module):
        # main() calls Django's execute_from_command_line() to do the work.
        from django.conf import settings

        argv = "django-mini --admin runserver".split()
        djangomini.main(argv)

        execute_from_command_line.assert_called_once_with(["django-mini", "runserver"])
示例#2
0
    def test_main_full(self, call_command, import_module, import_module2):
        # main() calls Django's execute_from_command_line(), full example.
        from django.conf import settings

        argv = (
            "django-mini --admin -a app1 --app app2"
            " --database sqlite:////var/run/db.sqlite --static-url /cdn/"
            " runserver --insecure 80"
        ).split()

        djangomini.main(argv)

        call_command.assert_called_once_with(["django-mini", "runserver", "--insecure", "80"])
        apps = ["django.contrib.admin", "app1", "app2"]
        for app in apps:
            self.assertTrue(app in settings.INSTALLED_APPS)
        self.assertEqual(settings.DATABASES["default"]["ENGINE"], "django.db.backends.sqlite3")
        self.assertEqual(settings.DATABASES["default"]["NAME"], "/var/run/db.sqlite")
        self.assertEqual(settings.STATIC_URL, "/cdn/")
示例#3
0
#!/usr/bin/env python
import djangomini
import sys


djangomini.main(sys.argv)