comparison tests/test_data_linker.py @ 261:b51ddb0c260b

tests: Fix linker tests.
author Ludovic Chabant <ludovic@chabant.com>
date Tue, 24 Feb 2015 08:04:49 -0800
parents 879fe1457e48
children 27b10024f8d8
comparison
equal deleted inserted replaced
260:07b4b8484c0a 261:b51ddb0c260b
35 (False, 'good', False, '/something/good')]) 35 (False, 'good', False, '/something/good')])
36 ]) 36 ])
37 def test_linker_iteration(fs, page_path, expected): 37 def test_linker_iteration(fs, page_path, expected):
38 with mock_fs_scope(fs): 38 with mock_fs_scope(fs):
39 app = fs.getApp() 39 app = fs.getApp()
40 app.config.set('site/pretty_urls', True)
40 src = app.getSource('pages') 41 src = app.getSource('pages')
41 linker = Linker(src, page_path=page_path) 42 linker = Linker(src, page_path)
42 actual = list(iter(linker)) 43 actual = list(iter(linker))
43 44
44 assert len(actual) == len(expected) 45 assert len(actual) == len(expected)
45 for (a, e) in zip(actual, expected): 46 for (a, e) in zip(actual, expected):
46 is_dir, name, is_self, url = e 47 is_dir, name, is_self, url = e
78 ('/something/good', False)]) 79 ('/something/good', False)])
79 ]) 80 ])
80 def test_recursive_linker_iteration(fs, page_path, expected): 81 def test_recursive_linker_iteration(fs, page_path, expected):
81 with mock_fs_scope(fs): 82 with mock_fs_scope(fs):
82 app = fs.getApp() 83 app = fs.getApp()
84 app.config.set('site/pretty_urls', True)
83 src = app.getSource('pages') 85 src = app.getSource('pages')
84 linker = Linker(src, page_path=page_path) 86 linker = Linker(src, page_path)
85 actual = list(iter(linker.allpages)) 87 actual = list(iter(linker.allpages))
86 88
87 assert len(actual) == len(expected) 89 assert len(actual) == len(expected)
88 for i, (a, e) in enumerate(zip(actual, expected)): 90 for i, (a, e) in enumerate(zip(actual, expected)):
89 assert a.is_dir is False 91 assert a.is_dir is False