def test_get_application(self):
     app = get_application(SOME_VARIABLE=True)
     self.assertIsInstance(app, Flask)
     self.assertTrue(app.config["SOME_VARIABLE"])
     self.assertEqual(app.name, "pyfarm.master")
     import pyfarm.master
     static_folder = os.path.join(os.path.dirname(pyfarm.master.__file__),
                                  "static")
     self.assertEqual(app.static_folder, static_folder)
 def test_get_application(self):
     app = get_application(SOME_VARIABLE=True)
     self.assertIsInstance(app, Flask)
     self.assertTrue(app.config["SOME_VARIABLE"])
     self.assertEqual(app.name, "pyfarm.master")
     import pyfarm.master
     static_folder = os.path.join(
         os.path.dirname(pyfarm.master.__file__), "static")
     self.assertEqual(app.static_folder, static_folder)
Exemple #3
0
    def setup_app(self):
        """
        Constructs the application object and assigns the instance
        variables for tests.  If you're testing the master your
        sublcass will probably need to extend this method.
        """
        environment = os.environ.copy()
        environment.setdefault("app_name", uuid.uuid4().hex)
        self.app = get_application(**environment)

        @self.app.before_request
        def before_request_handler():
            return before_request()

        # construct response class so we can use the json methods
        # in our handlers
        self._original_response_class = self.app.response_class
        self.app.response_class = make_test_response(self.app.response_class)

        # construct and push the context
        self._context = self.app.test_request_context()
        self._context.push()
Exemple #4
0
    def setup_app(self):
        """
        Constructs the application object and assigns the instance
        variables for tests.  If you're testing the master your
        sublcass will probably need to extend this method.
        """
        environment = os.environ.copy()
        environment.setdefault("app_name", uuid.uuid4().hex)
        self.app = get_application(**environment)

        @self.app.before_request
        def before_request_handler():
            return before_request()

        # construct response class so we can use the json methods
        # in our handlers
        self._original_response_class = self.app.response_class
        self.app.response_class = make_test_response(self.app.response_class)

        # construct and push the context
        self._context = self.app.test_request_context()
        self._context.push()