Example #1
0
 def test_adds_handler(self, mock_add_handler):
     app.create_app()
     # make sure it was called
     self.assertEqual(mock_add_handler.call_count, 1)
     # make sure the first argument is the right type
     self.assertIsInstance(mock_add_handler.call_args[0][0], logging.Handler)
     # make sure the first argument was the only argument
     mock_add_handler.assert_called_once_with(mock_add_handler.call_args[0][0])
Example #2
0
    def test_calls_search(self, mock_environ_get):
        # reset to the default state
        search.backend = search.SearchBackend()

        # run the "create_app", which because of the mock_environ_get, will load
        # our demo config. That config has GSA info.
        with mock.patch('crane.app.init_logging'):
            app.create_app()

        # this will only be true if the search config was parsed
        self.assertIsInstance(search.backend, GSA)
Example #3
0
File: base.py Project: pulp/crane
 def setUp(self):
     with mock.patch('crane.app.init_logging'):
         self.app = app.create_app()
     self.app.config[config.KEY_DATA_DIR] = metadata_good_path
     self.app.config[config.KEY_ENDPOINT] = 'localhost:5000'
     self.app.config['DEBUG'] = True
     data.load_all(self.app)
     self.test_client = self.app.test_client()
Example #4
0
 def setUp(self):
     with mock.patch('crane.app.init_logging'):
         self.app = app.create_app()
     self.app.config[config.KEY_DATA_DIR] = metadata_good_path
     self.app.config[config.KEY_ENDPOINT] = 'localhost:5000'
     self.app.config['DEBUG'] = True
     data.load_all(self.app)
     self.test_client = self.app.test_client()
Example #5
0
 def setUp(self):
     super(TestSetLogLevel, self).setUp()
     self.app = app.create_app()
Example #6
0
 def setUp(self):
     super(TestCreateApp, self).setUp()
     with mock.patch('crane.app.init_logging') as mock_init_logging:
         self.app = app.create_app()
     # hold this so one of the tests can inspect it
     self.mock_init_logging = mock_init_logging
Example #7
0
from crane.app import create_app

create_app().run(port=5001)
Example #8
0
from crane.app import create_app

application = create_app()
Example #9
0
 def setUp(self):
     super(TestSendFileCacheTimeout, self).setUp()
     self.app = app.create_app()
Example #10
0
 def setUp(self):
     super(TestSendFileCacheTimeout, self).setUp()
     self.app = app.create_app()
Example #11
0
 def setUp(self):
     super(TestSetLogLevel, self).setUp()
     with mock.patch('crane.app.init_logging') as mock_init_logging:
         self.app = app.create_app()
Example #12
0
 def setUp(self):
     super(TestSetLogLevel, self).setUp()
     with mock.patch('crane.app.init_logging') as mock_init_logging:
         self.app = app.create_app()