1 # -*- coding: utf8 -*- |
1 # -*- coding: utf8 -*- |
2 from StringIO import StringIO |
2 from StringIO import StringIO |
3 |
3 |
4 import webtest |
4 import webtest |
|
5 |
5 import pyramid.request |
6 import pyramid.request |
6 |
7 |
7 from cubicweb.devtools.webtest import CubicWebTestTC |
|
8 |
|
9 from pyramid_cubicweb import make_cubicweb_application |
|
10 from pyramid_cubicweb.core import CubicWebPyramidRequest |
8 from pyramid_cubicweb.core import CubicWebPyramidRequest |
11 |
9 from pyramid_cubicweb.tests import PyramidCWTest |
12 |
|
13 class PyramidCWTest(CubicWebTestTC): |
|
14 @classmethod |
|
15 def init_config(cls, config): |
|
16 super(PyramidCWTest, cls).init_config(config) |
|
17 config.global_set_option('https-url', 'https://localhost.local/') |
|
18 config['pyramid-auth-secret'] = 'authsecret' |
|
19 config['pyramid-session-secret'] = 'sessionsecret' |
|
20 |
|
21 def setUp(self): |
|
22 # Skip CubicWebTestTC setUp |
|
23 super(CubicWebTestTC, self).setUp() |
|
24 config = make_cubicweb_application(self.config) |
|
25 self.pyr_registry = config.registry |
|
26 self.webapp = webtest.TestApp(config.make_wsgi_app()) |
|
27 |
10 |
28 |
11 |
29 class WSGIAppTest(PyramidCWTest): |
12 class WSGIAppTest(PyramidCWTest): |
30 def make_request(self, path, environ=None, **kw): |
13 def make_request(self, path, environ=None, **kw): |
31 r = webtest.app.TestRequest.blank(path, environ, **kw) |
14 r = webtest.app.TestRequest.blank(path, environ, **kw) |