[test] Add a test for WebConfiguration.locate_all_files() 3.26
authorDenis Laxalde <denis.laxalde@logilab.fr>
Thu, 15 Feb 2018 14:11:18 +0100
branch3.26
changeset 12267 4ec56c0bcc5c
parent 12266 043db1f91922
child 12268 d84bc85f7f70
[test] Add a test for WebConfiguration.locate_all_files() We are going to change the implementation, make sure there's no regression.
cubicweb/web/test/unittest_webconfig.py
--- 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))