[test] Add a test for WebConfiguration.locate_all_files()
We are going to change the implementation, make sure there's no
regression.
--- a/cubicweb/web/test/unittest_webconfig.py Thu Feb 15 09:35:48 2018 +0100
+++ b/cubicweb/web/test/unittest_webconfig.py Thu Feb 15 14:11:18 2018 +0100
@@ -19,6 +19,7 @@
"""cubicweb.web.webconfig unit tests"""
import os
+from os import path
from unittest import TestCase
from cubicweb.devtools import ApptestConfiguration, fake
@@ -52,6 +53,18 @@
'neither "web" nor "shared" found in cubicwebcsspath (%s)'
% cubicwebcsspath)
+ def test_locate_all_files(self):
+ wdocfiles = list(self.config.locate_all_files('toc.xml'))
+ for fpath in wdocfiles:
+ self.assertTrue(path.exists(fpath), fpath)
+ for expected in [path.join('cubes', 'file', 'wdoc', 'toc.xml'),
+ path.join('cubes', 'shared', 'wdoc', 'toc.xml')]:
+ for fpath in wdocfiles:
+ if fpath.endswith(expected):
+ break
+ else:
+ raise AssertionError('%s not found in %s' % (expected, wdocfiles))
+
def test_sign_text(self):
signature = self.config.sign_text(u'hôp')
self.assertTrue(self.config.check_text_sign(u'hôp', signature))