17 # You should have received a copy of the GNU Lesser General Public License along |
17 # You should have received a copy of the GNU Lesser General Public License along |
18 # with CubicWeb. If not, see <http://www.gnu.org/licenses/>. |
18 # with CubicWeb. If not, see <http://www.gnu.org/licenses/>. |
19 """cubicweb.web.webconfig unit tests""" |
19 """cubicweb.web.webconfig unit tests""" |
20 |
20 |
21 import os |
21 import os |
|
22 from os import path |
22 from unittest import TestCase |
23 from unittest import TestCase |
23 |
24 |
24 from cubicweb.devtools import ApptestConfiguration, fake |
25 from cubicweb.devtools import ApptestConfiguration, fake |
25 |
26 |
26 |
27 |
50 # 'shared' if tests under apycot |
51 # 'shared' if tests under apycot |
51 self.assertTrue('web' in cubicwebcsspath or 'shared' in cubicwebcsspath, |
52 self.assertTrue('web' in cubicwebcsspath or 'shared' in cubicwebcsspath, |
52 'neither "web" nor "shared" found in cubicwebcsspath (%s)' |
53 'neither "web" nor "shared" found in cubicwebcsspath (%s)' |
53 % cubicwebcsspath) |
54 % cubicwebcsspath) |
54 |
55 |
|
56 def test_locate_all_files(self): |
|
57 wdocfiles = list(self.config.locate_all_files('toc.xml')) |
|
58 for fpath in wdocfiles: |
|
59 self.assertTrue(path.exists(fpath), fpath) |
|
60 for expected in [path.join('cubes', 'file', 'wdoc', 'toc.xml'), |
|
61 path.join('cubes', 'shared', 'wdoc', 'toc.xml')]: |
|
62 for fpath in wdocfiles: |
|
63 if fpath.endswith(expected): |
|
64 break |
|
65 else: |
|
66 raise AssertionError('%s not found in %s' % (expected, wdocfiles)) |
|
67 |
55 def test_sign_text(self): |
68 def test_sign_text(self): |
56 signature = self.config.sign_text(u'hôp') |
69 signature = self.config.sign_text(u'hôp') |
57 self.assertTrue(self.config.check_text_sign(u'hôp', signature)) |
70 self.assertTrue(self.config.check_text_sign(u'hôp', signature)) |
58 |
71 |
59 |
72 |