cubicweb/pyramid/test/__init__.py
author Guillaume Vandevelde <gvandevelde@logilab.fr>
Mon, 10 Feb 2020 16:56:02 +0100
branch3.26
changeset 12874 cc71a801b846
parent 12088 477a59a45786
child 12593 c30f8dc81f22
permissions -rw-r--r--
[utils] Add the possibility to add elements in the head of an UStringIO list

import webtest

from pyramid.config import Configurator
from cubicweb.devtools.webtest import CubicWebTestTC


class PyramidCWTest(CubicWebTestTC):
    settings = {}

    @classmethod
    def init_config(cls, config):
        super(PyramidCWTest, cls).init_config(config)
        config.global_set_option('anonymous-user', 'anon')

    def setUp(self):
        # Skip CubicWebTestTC setUp
        super(CubicWebTestTC, self).setUp()
        settings = {'cubicweb.bwcompat': False}
        settings.update(self.settings)
        config = Configurator(settings=settings)
        config.registry['cubicweb.repository'] = self.repo
        config.include('cubicweb.pyramid')
        self.includeme(config)
        self.pyr_registry = config.registry
        self.webapp = webtest.TestApp(
            config.make_wsgi_app(),
            extra_environ={'wsgi.url_scheme': 'https'})

    def includeme(self, config):
        pass