cubicweb/pyramid/test/__init__.py
changeset 11971 6c035cfef04f
parent 11958 950ce7d9f642
child 12088 477a59a45786
equal deleted inserted replaced
11970:b282ef22b5ab 11971:6c035cfef04f
     1 import webtest
     1 import webtest
     2 
     2 
       
     3 from pyramid.config import Configurator
     3 from cubicweb.devtools.webtest import CubicWebTestTC
     4 from cubicweb.devtools.webtest import CubicWebTestTC
     4 
       
     5 from cubicweb.pyramid import config_from_cwconfig
       
     6 
     5 
     7 
     6 
     8 class PyramidCWTest(CubicWebTestTC):
     7 class PyramidCWTest(CubicWebTestTC):
     9     settings = {}
     8     settings = {}
    10 
     9 
    14         config.global_set_option('anonymous-user', 'anon')
    13         config.global_set_option('anonymous-user', 'anon')
    15 
    14 
    16     def setUp(self):
    15     def setUp(self):
    17         # Skip CubicWebTestTC setUp
    16         # Skip CubicWebTestTC setUp
    18         super(CubicWebTestTC, self).setUp()
    17         super(CubicWebTestTC, self).setUp()
    19         config = config_from_cwconfig(self.config, self.settings)
    18         config = Configurator(settings=self.settings)
       
    19         config.registry['cubicweb.repository'] = self.repo
       
    20         config.include('cubicweb.pyramid')
    20         self.includeme(config)
    21         self.includeme(config)
    21         self.pyr_registry = config.registry
    22         self.pyr_registry = config.registry
    22         self.webapp = webtest.TestApp(
    23         self.webapp = webtest.TestApp(
    23             config.make_wsgi_app(),
    24             config.make_wsgi_app(),
    24             extra_environ={'wsgi.url_scheme': 'https'})
    25             extra_environ={'wsgi.url_scheme': 'https'})