Esempio n. 1
0
    def test_script(self):
        settings_dotted_path = "cheeseshop.development"
        # ^^^ Our regular os.environ.setdefault patching doesn't help.
        # Patching get_wsgi_application already imports the DB layer, so the
        # settings are already needed there!
        with mock.patch("os.environ", {"DJANGO_SETTINGS_MODULE": settings_dotted_path}):
            with mock.patch("django.core.wsgi.get_wsgi_application") as patched_method:
                from djangorecipe import wsgi

                wsgi.main(settings_dotted_path, logfile=None)
                self.assertTrue(patched_method.called)
Esempio n. 2
0
 def test_script(self):
     settings_dotted_path = 'cheeseshop.development'
     # ^^^ Our regular os.environ.setdefault patching doesn't help.
     # Patching get_wsgi_application already imports the DB layer, so the
     # settings are already needed there!
     with mock.patch('os.environ',
                     {'DJANGO_SETTINGS_MODULE': settings_dotted_path}):
         with mock.patch('django.core.wsgi.get_wsgi_application') \
              as patched_method:
             from djangorecipe import wsgi
             wsgi.main(settings_dotted_path, logfile=None)
             self.assertTrue(patched_method.called)
Esempio n. 3
0
 def test_script(self, WSGIHandler, setup_environ):
     # The fcgi is a warpper for the django fcgi script.
     from djangorecipe import wsgi
     wsgi.main('cheeseshop.development', logfile=None)
     self.assertEqual(WSGIHandler.call_args, {})
Esempio n. 4
0
 def test_script(self, WSGIHandler, setup_environ):
     # The fcgi is a warpper for the django fcgi script.
     from djangorecipe import wsgi
     wsgi.main('cheeseshop.development', logfile=None)
     self.assertEqual(WSGIHandler.call_args, {})