def test_include_fails_if_missing_config(self): config = testing.setUp() settings = config.get_settings() kinto.core.initialize(config, '0.0.1') with self.assertRaises(ConfigurationError) as e: config.include(includeme) main({}, None, **settings) assert str(e.exception) == ( 'kinto-algolia needs kinto.algolia.application_id ' 'and kinto.algolia.api_key settings to be set.')
def _get_test_app(self, settings=None): app_settings = self.get_app_settings(settings) self.config = Configurator(settings=app_settings) self.config.add_subscriber(self.listener, ServerFlushed) self.config.commit() app = webtest.TestApp(main({}, config=self.config, **app_settings)) app.RequestClass = core_support.get_request_class(prefix="v1") return app
def test_init_sets_command_on_registry(self): app = main({"command": "migrate"}, None, **self.get_app_settings()) self.assertEqual(app.registry.command, "migrate")
def test_init_with_no_global_config_doesnt_crash(self): app = main(None, None, **self.get_app_settings()) self.assertEqual(app.registry.command, None)
def test_init_sets_command_on_registry(self): app = main({'command': 'migrate'}, None, **self.get_app_settings()) self.assertEqual(app.registry.command, 'migrate')
def get_test_app(self): return webtest.TestApp(kinto.main({}, **self.get_app_settings()))