cubicweb/pyramid/test/__init__.py
author Sylvain Thénault <sylvain.thenault@logilab.fr>
Mon, 23 Jan 2017 11:02:21 +0100
changeset 11913 4516c3956d46
parent 11631 faf279e33298
child 11958 950ce7d9f642
permissions -rw-r--r--
Drop support for https-url in all-in-one.conf This feature allowing an instance to have both anonymous and authenticated (https) url is not used anymore, let's drop it.
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('anonymous-user', 'anon')
82e86cd8e217 Move PyramidCWTest to pyramid_cubicweb.tests
Christophe de Vienne <christophe@unlish.com>
parents: 11508
diff changeset
    15
82e86cd8e217 Move PyramidCWTest to pyramid_cubicweb.tests
Christophe de Vienne <christophe@unlish.com>
parents: 11508
diff changeset
    16
    def setUp(self):
82e86cd8e217 Move PyramidCWTest to pyramid_cubicweb.tests
Christophe de Vienne <christophe@unlish.com>
parents: 11508
diff changeset
    17
        # Skip CubicWebTestTC setUp
82e86cd8e217 Move PyramidCWTest to pyramid_cubicweb.tests
Christophe de Vienne <christophe@unlish.com>
parents: 11508
diff changeset
    18
        super(CubicWebTestTC, self).setUp()
11564
a6547ff97ce0 Allow tests to override pyramid_settings
Christophe de Vienne <christophe@unlish.com>
parents: 11514
diff changeset
    19
        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
    20
        self.includeme(config)
82e86cd8e217 Move PyramidCWTest to pyramid_cubicweb.tests
Christophe de Vienne <christophe@unlish.com>
parents: 11508
diff changeset
    21
        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
    22
        self.webapp = webtest.TestApp(
73bf8377a3d5 [auth] Authtkt http_only and secure by default
Christophe de Vienne <cdevienne@gmail.com>
parents: 11564
diff changeset
    23
            config.make_wsgi_app(),
73bf8377a3d5 [auth] Authtkt http_only and secure by default
Christophe de Vienne <cdevienne@gmail.com>
parents: 11564
diff changeset
    24
            extra_environ={'wsgi.url_scheme': 'https'})
11514
82e86cd8e217 Move PyramidCWTest to pyramid_cubicweb.tests
Christophe de Vienne <christophe@unlish.com>
parents: 11508
diff changeset
    25
82e86cd8e217 Move PyramidCWTest to pyramid_cubicweb.tests
Christophe de Vienne <christophe@unlish.com>
parents: 11508
diff changeset
    26
    def includeme(self, config):
82e86cd8e217 Move PyramidCWTest to pyramid_cubicweb.tests
Christophe de Vienne <christophe@unlish.com>
parents: 11508
diff changeset
    27
        pass