Exemple #1
0
 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.')
Exemple #2
0
    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 _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
Exemple #4
0
    def test_init_sets_command_on_registry(self):
        app = main({"command": "migrate"}, None, **self.get_app_settings())

        self.assertEqual(app.registry.command, "migrate")
Exemple #5
0
    def test_init_with_no_global_config_doesnt_crash(self):
        app = main(None, None, **self.get_app_settings())

        self.assertEqual(app.registry.command, None)
Exemple #6
0
    def test_init_sets_command_on_registry(self):
        app = main({'command': 'migrate'}, None, **self.get_app_settings())

        self.assertEqual(app.registry.command, 'migrate')
Exemple #7
0
 def get_test_app(self):
     return webtest.TestApp(kinto.main({}, **self.get_app_settings()))