cubicweb/pyramid/test/__init__.py
author Denis Laxalde <denis.laxalde@logilab.fr>
Fri, 10 Feb 2017 16:33:16 +0100
changeset 11958 950ce7d9f642
parent 11913 4516c3956d46
child 11971 6c035cfef04f
permissions -rw-r--r--
[pyramid] Rename make_cubicweb_application function as config_from_cwconfig And update its docstring. This function does not actually "make a cubicweb application", it just builds a pyramid.config.Configurator instance from a CubicWeb config object.

import webtest

from cubicweb.devtools.webtest import CubicWebTestTC

from cubicweb.pyramid import config_from_cwconfig


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()
        config = config_from_cwconfig(self.config, self.settings)
        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