comparison tests/test_data_assetor.py @ 674:f987b29d6fab

tests: Add ability to run tests with a theme site. * Remove automatic creating of `config.yml`. * Add option to specify `theme_config` in YAML tests.
author Ludovic Chabant <ludovic@chabant.com>
date Sun, 06 Mar 2016 23:48:01 -0800
parents e7b865f8f335
children 72f17534d58e
comparison
equal deleted inserted replaced
673:d6403c21bdea 674:f987b29d6fab
48 assert assetor[en] == path 48 assert assetor[en] == path
49 49
50 50
51 def test_missing_asset(): 51 def test_missing_asset():
52 with pytest.raises(KeyError): 52 with pytest.raises(KeyError):
53 fs = mock_fs().withPage('pages/foo/bar') 53 fs = (mock_fs()
54 .withConfig()
55 .withPage('pages/foo/bar'))
54 with mock_fs_scope(fs): 56 with mock_fs_scope(fs):
55 page = MagicMock() 57 page = MagicMock()
56 page.app = fs.getApp(cache=False) 58 page.app = fs.getApp(cache=False)
57 page.path = fs.path('/kitchen/pages/foo/bar.md') 59 page.path = fs.path('/kitchen/pages/foo/bar.md')
58 assetor = Assetor(page, '/foo/bar') 60 assetor = Assetor(page, '/foo/bar')
60 62
61 63
62 def test_multiple_assets_with_same_name(): 64 def test_multiple_assets_with_same_name():
63 with pytest.raises(UnsupportedAssetsError): 65 with pytest.raises(UnsupportedAssetsError):
64 fs = (mock_fs() 66 fs = (mock_fs()
67 .withConfig()
65 .withPage('pages/foo/bar') 68 .withPage('pages/foo/bar')
66 .withPageAsset('pages/foo/bar', 'one.txt', 'one text') 69 .withPageAsset('pages/foo/bar', 'one.txt', 'one text')
67 .withPageAsset('pages/foo/bar', 'one.jpg', 'one picture')) 70 .withPageAsset('pages/foo/bar', 'one.jpg', 'one picture'))
68 with mock_fs_scope(fs): 71 with mock_fs_scope(fs):
69 page = MagicMock() 72 page = MagicMock()