cubicweb/pyramid/test/__init__.py
author Yann Voté <yann.vote@logilab.fr>
Mon, 26 Sep 2016 14:52:12 +0200
changeset 11631 faf279e33298
parent 11606 pyramid_cubicweb/tests/__init__.py@e245680acce3
child 11913 4516c3956d46
permissions -rw-r--r--
Merge with pyramid-cubicweb The following tasks have been done: - merge packaging files - merge documentation - move pyramid_cubicweb package at cubicweb/pyramid and update imports accordingly - rename tests directory into test - move pyramid-cubicweb README.rst into README.pyramid.rst until better idea - add a test dependency on unreleased cubicweb-pyramid to have both py27 and py34 tests pass Closes #14023058.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
11514
82e86cd8e217 Move PyramidCWTest to pyramid_cubicweb.tests
Christophe de Vienne <christophe@unlish.com>
parents: 11508
diff changeset
     1
import webtest
82e86cd8e217 Move PyramidCWTest to pyramid_cubicweb.tests
Christophe de Vienne <christophe@unlish.com>
parents: 11508
diff changeset
     2
82e86cd8e217 Move PyramidCWTest to pyramid_cubicweb.tests
Christophe de Vienne <christophe@unlish.com>
parents: 11508
diff changeset
     3
from cubicweb.devtools.webtest import CubicWebTestTC
82e86cd8e217 Move PyramidCWTest to pyramid_cubicweb.tests
Christophe de Vienne <christophe@unlish.com>
parents: 11508
diff changeset
     4
11631
faf279e33298 Merge with pyramid-cubicweb
Yann Voté <yann.vote@logilab.fr>
parents: 11606
diff changeset
     5
from cubicweb.pyramid import make_cubicweb_application
11514
82e86cd8e217 Move PyramidCWTest to pyramid_cubicweb.tests
Christophe de Vienne <christophe@unlish.com>
parents: 11508
diff changeset
     6
82e86cd8e217 Move PyramidCWTest to pyramid_cubicweb.tests
Christophe de Vienne <christophe@unlish.com>
parents: 11508
diff changeset
     7
82e86cd8e217 Move PyramidCWTest to pyramid_cubicweb.tests
Christophe de Vienne <christophe@unlish.com>
parents: 11508
diff changeset
     8
class PyramidCWTest(CubicWebTestTC):
11564
a6547ff97ce0 Allow tests to override pyramid_settings
Christophe de Vienne <christophe@unlish.com>
parents: 11514
diff changeset
     9
    settings = {}
a6547ff97ce0 Allow tests to override pyramid_settings
Christophe de Vienne <christophe@unlish.com>
parents: 11514
diff changeset
    10
11514
82e86cd8e217 Move PyramidCWTest to pyramid_cubicweb.tests
Christophe de Vienne <christophe@unlish.com>
parents: 11508
diff changeset
    11
    @classmethod
82e86cd8e217 Move PyramidCWTest to pyramid_cubicweb.tests
Christophe de Vienne <christophe@unlish.com>
parents: 11508
diff changeset
    12
    def init_config(cls, config):
82e86cd8e217 Move PyramidCWTest to pyramid_cubicweb.tests
Christophe de Vienne <christophe@unlish.com>
parents: 11508
diff changeset
    13
        super(PyramidCWTest, cls).init_config(config)
82e86cd8e217 Move PyramidCWTest to pyramid_cubicweb.tests
Christophe de Vienne <christophe@unlish.com>
parents: 11508
diff changeset
    14
        config.global_set_option('https-url', 'https://localhost.local/')
82e86cd8e217 Move PyramidCWTest to pyramid_cubicweb.tests
Christophe de Vienne <christophe@unlish.com>
parents: 11508
diff changeset
    15
        config.global_set_option('anonymous-user', 'anon')
11593
73bf8377a3d5 [auth] Authtkt http_only and secure by default
Christophe de Vienne <cdevienne@gmail.com>
parents: 11564
diff changeset
    16
        config.https_uiprops = None
73bf8377a3d5 [auth] Authtkt http_only and secure by default
Christophe de Vienne <cdevienne@gmail.com>
parents: 11564
diff changeset
    17
        config.https_datadir_url = None
11514
82e86cd8e217 Move PyramidCWTest to pyramid_cubicweb.tests
Christophe de Vienne <christophe@unlish.com>
parents: 11508
diff changeset
    18
82e86cd8e217 Move PyramidCWTest to pyramid_cubicweb.tests
Christophe de Vienne <christophe@unlish.com>
parents: 11508
diff changeset
    19
    def setUp(self):
82e86cd8e217 Move PyramidCWTest to pyramid_cubicweb.tests
Christophe de Vienne <christophe@unlish.com>
parents: 11508
diff changeset
    20
        # Skip CubicWebTestTC setUp
82e86cd8e217 Move PyramidCWTest to pyramid_cubicweb.tests
Christophe de Vienne <christophe@unlish.com>
parents: 11508
diff changeset
    21
        super(CubicWebTestTC, self).setUp()
11564
a6547ff97ce0 Allow tests to override pyramid_settings
Christophe de Vienne <christophe@unlish.com>
parents: 11514
diff changeset
    22
        config = make_cubicweb_application(self.config, self.settings)
11514
82e86cd8e217 Move PyramidCWTest to pyramid_cubicweb.tests
Christophe de Vienne <christophe@unlish.com>
parents: 11508
diff changeset
    23
        self.includeme(config)
82e86cd8e217 Move PyramidCWTest to pyramid_cubicweb.tests
Christophe de Vienne <christophe@unlish.com>
parents: 11508
diff changeset
    24
        self.pyr_registry = config.registry
11593
73bf8377a3d5 [auth] Authtkt http_only and secure by default
Christophe de Vienne <cdevienne@gmail.com>
parents: 11564
diff changeset
    25
        self.webapp = webtest.TestApp(
73bf8377a3d5 [auth] Authtkt http_only and secure by default
Christophe de Vienne <cdevienne@gmail.com>
parents: 11564
diff changeset
    26
            config.make_wsgi_app(),
73bf8377a3d5 [auth] Authtkt http_only and secure by default
Christophe de Vienne <cdevienne@gmail.com>
parents: 11564
diff changeset
    27
            extra_environ={'wsgi.url_scheme': 'https'})
11514
82e86cd8e217 Move PyramidCWTest to pyramid_cubicweb.tests
Christophe de Vienne <christophe@unlish.com>
parents: 11508
diff changeset
    28
82e86cd8e217 Move PyramidCWTest to pyramid_cubicweb.tests
Christophe de Vienne <christophe@unlish.com>
parents: 11508
diff changeset
    29
    def includeme(self, config):
82e86cd8e217 Move PyramidCWTest to pyramid_cubicweb.tests
Christophe de Vienne <christophe@unlish.com>
parents: 11508
diff changeset
    30
        pass