async def test_resources_with_assets_directory_path(self): assets_directory_path = '/tmp/betty' configuration = Configuration(**self._MINIMAL_CONFIGURATION_ARGS) configuration.assets_directory_path = assets_directory_path async with Site(configuration) as sut: self.assertEquals(2, len(sut.assets.paths)) self.assertEquals(assets_directory_path, sut.assets.paths[0])
async def test_assets_with_assets_directory_path(self) -> None: assets_directory_path = Path('/tmp/betty') configuration = Configuration(**self._MINIMAL_CONFIGURATION_ARGS) configuration.assets_directory_path = assets_directory_path async with App(configuration) as sut: self.assertEquals(2, len(sut.assets.paths)) self.assertEquals((assets_directory_path, None), sut.assets.paths[0])
async def test(self): with TemporaryDirectory() as output_directory_path: with TemporaryDirectory() as assets_directory_path: makedirs(join(assets_directory_path, 'public', 'localized')) with open(join(assets_directory_path, 'public', 'localized', 'index.html.j2'), 'w') as f: f.write('{% block page_content %}Betty was here{% endblock %}') configuration = Configuration( output_directory_path, 'https://ancestry.example.com') configuration.assets_directory_path = assets_directory_path site = Site(configuration) await generate(site) with open(join(configuration.www_directory_path, 'index.html')) as f: self.assertIn('Betty was here', f.read())
async def test(self): with TemporaryDirectory() as output_directory_path: with TemporaryDirectory() as assets_directory_path_str: assets_directory_path = Path(assets_directory_path_str) localized_assets_directory_path = Path( assets_directory_path) / 'public' / 'localized' localized_assets_directory_path.mkdir(parents=True) with open( str(localized_assets_directory_path / 'index.html.j2'), 'w') as f: f.write( '{% block page_content %}Betty was here{% endblock %}') configuration = Configuration(output_directory_path, 'https://ancestry.example.com') configuration.assets_directory_path = assets_directory_path async with App(configuration) as app: await generate(app) with open(configuration.www_directory_path / 'index.html') as f: self.assertIn('Betty was here', f.read())
def test_assets_directory_path_with_path(self): sut = Configuration('~', 'https://example.com') assets_directory_path = '/tmp/betty-assets' sut.assets_directory_path = assets_directory_path self.assertEquals(assets_directory_path, sut.assets_directory_path)