equal
deleted
inserted
replaced
1 from __future__ import absolute_import |
|
2 |
|
3 import webtest |
|
4 |
|
5 from cubicweb.wsgi import handler |
|
6 from cubicweb.devtools.testlib import CubicWebTC |
|
7 |
|
8 |
|
9 class CubicWebTestTC(CubicWebTC): |
|
10 def setUp(self): |
|
11 super(CubicWebTestTC, self).setUp() |
|
12 self.config.global_set_option('base-url', 'http://localhost.local/') |
|
13 # call load_configuration again to let the config reset its datadir_url |
|
14 self.config.load_configuration() |
|
15 webapp = handler.CubicWebWSGIApplication(self.config) |
|
16 self.webapp = webtest.TestApp(webapp) |
|
17 |
|
18 def tearDown(self): |
|
19 del self.webapp |
|
20 super(CubicWebTestTC, self).tearDown() |
|
21 |
|
22 def login(self, user=None, password=None, **args): |
|
23 if user is None: |
|
24 user = self.admlogin |
|
25 if password is None: |
|
26 password = self.admpassword if user == self.admlogin else user |
|
27 args.update({ |
|
28 '__login': user, |
|
29 '__password': password |
|
30 }) |
|
31 return self.webapp.get('/login', args) |
|
32 |
|
33 def logout(self): |
|
34 return self.webapp.get('/logout') |
|