Exemplo n.º 1
0
    def test_setup_configurator(self):
        """
        A simple test for the :func:`pyramidcms.config.setup_configurator`
        function, given some test settings, ensures we get a Configurator
        object back.
        """
        settings = {
            'session.secret': 'super-secret-key',
            'session.cookie_httponly': True,
            'session.cookie_secure': False,
        }

        config = setup_configurator(settings)
        self.assertEqual(type(config), Configurator)
Exemplo n.º 2
0
    def _create_app(self, settings):
        """
        Creates a test app, the app matches the app normally created when
        using the pyramidcms project scaffold.

        The only difference is that we create the models during app startup
        in an in-memory SQLite database.  This is normally handed by
        Alembic migrations.
        """
        config = setup_configurator(settings)
        config.include('pyramidcms')

        # creates all the tables in the in-memory sqlite database
        print('Using models: {}'.format(models.__all__))
        Base.metadata.create_all(DBSession.bind)

        config.scan()
        return config.make_wsgi_app()