# HG changeset patch # User Denis Laxalde # Date 1518700278 -3600 # Node ID 4ec56c0bcc5ce932c612d785e6d6cc7714f717bc # Parent 043db1f91922bdd57607ef6183702e596bdf5a44 [test] Add a test for WebConfiguration.locate_all_files() We are going to change the implementation, make sure there's no regression. diff -r 043db1f91922 -r 4ec56c0bcc5c 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))