Mercurial > piecrust2
comparison tests/test_sources_autoconfig.py @ 363:dd25bd3ce1f9
serve: Refactoring and fixes to be able to serve taxonomy pages.
* Page sources' `findPagePath` is renamed to `findPageFactory`, so that it
also returns source metadata.
* Page refs now store possible hits more properly, and use the previous point
to also store metadata. As a result, they can also return a proper factory.
* Implement `findPageFactory` correctly in all built-in sources.
* When the Chef server matches a taxonomy page, get the source metadata from
the page ref in order to make a more proper page.
* Make the `getRoute(s)` functions explicitely say if they want taxonomy routes
or not.
| author | Ludovic Chabant <ludovic@chabant.com> |
|---|---|
| date | Sun, 26 Apr 2015 15:07:40 -0700 |
| parents | a2d283d1033d |
| children | e7b865f8f335 |
comparison
equal
deleted
inserted
replaced
| 362:ff595828a364 | 363:dd25bd3ce1f9 |
|---|---|
| 171 fs.withDir('kitchen/test') | 171 fs.withDir('kitchen/test') |
| 172 with mock_fs_scope(fs): | 172 with mock_fs_scope(fs): |
| 173 app = fs.getApp() | 173 app = fs.getApp() |
| 174 s = app.getSource('test') | 174 s = app.getSource('test') |
| 175 route_metadata = {'slug': route_path} | 175 route_metadata = {'slug': route_path} |
| 176 fac_path, metadata = s.findPagePath(route_metadata, MODE_PARSING) | 176 factory = s.findPageFactory(route_metadata, MODE_PARSING) |
| 177 assert fac_path == slashfix(expected_path) | 177 if factory is None: |
| 178 assert metadata == expected_metadata | 178 assert expected_path is None and expected_metadata is None |
| 179 return | |
| 180 assert factory.rel_path == slashfix(expected_path) | |
| 181 assert factory.metadata == expected_metadata | |
| 179 | 182 |
