From cf7091c52dbfc147f5928e43af517c4c448b3b00 Mon Sep 17 00:00:00 2001 From: Lakshmi Vyasarajan Date: Tue, 10 May 2011 18:05:54 +0530 Subject: [PATCH] Addded test for config ignore option --- hyde/tests/test_model.py | 4 +++- hyde/tests/test_site.py | 14 +++++++++++++- 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/hyde/tests/test_model.py b/hyde/tests/test_model.py index 31b99e1..795290d 100644 --- a/hyde/tests/test_model.py +++ b/hyde/tests/test_model.py @@ -110,6 +110,8 @@ class TestConfig(object): assert c.media_root_path == c.content_root_path.child_folder('media') assert hasattr(c, 'plugins') assert len(c.plugins) == 0 + assert hasattr(c, 'ignore') + assert c.ignore == ["*~", "*.bak"] assert c.deploy_root_path == TEST_SITE.child_folder('deploy') assert c.not_found == '404.html' @@ -153,4 +155,4 @@ class TestConfig(object): assert c.content_root_path == TEST_SITE.child_folder('site/stuff') assert c.media_root_path == c.content_root_path.child_folder('xxx') assert c.media_url == TEST_SITE.child_folder('/media') - assert c.deploy_root_path == Folder('~/deploy_site') \ No newline at end of file + assert c.deploy_root_path == Folder('~/deploy_site') diff --git a/hyde/tests/test_site.py b/hyde/tests/test_site.py index 9c10c78..e5a1131 100644 --- a/hyde/tests/test_site.py +++ b/hyde/tests/test_site.py @@ -218,4 +218,16 @@ class TestSiteWithConfig(object): resource = s.content.resource_from_relative_path( Folder("media").child(path)) assert resource - assert resource.full_url == "/media/" + path \ No newline at end of file + assert resource.full_url == "/media/" + path + + def test_config_ignore(self): + s = Site(self.SITE_PATH, config=self.config) + s.load() + path = 'apple-touch-icon.png' + resource = s.content.resource_from_relative_path(path) + assert resource + assert resource.full_url == "/" + path + s = Site(self.SITE_PATH, config=self.config) + s.config.ignore.append('*.png') + resource = s.content.resource_from_relative_path(path) + assert not resource