Пример #1
0
    def test_generation(self):
        with pytest.warns(None) as warnings:
            flourish = Flourish(
                source_dir='tests/source',
                templates_dir='tests/templates',
                output_dir=self.tempdir,
            )
            assert len(warnings) == 2

        with pytest.warns(None) as warnings:
            # one template has an invalid url() use
            flourish.generate_site()
            assert len(warnings) == 1
            assert 'tags-tag-page' in str(warnings[0].message)

        self.compare_directories()
Пример #2
0
    def test_invalid_prefixed_sources(self):
        with pytest.warns(None) as _warnings:
            _flourish = Flourish('tests/source')
            assert len(_warnings) == 2
            assert _flourish.sources.count() == 7

            _flourish.canonical_source_url(
                '/#type/#slug',
                None
            )

            assert [
                None,
                None,
                '/post/thing-one',
                '/post/thing-two',
                '/post/series/part-one',
                '/post/series/part-three',
                '/post/series/part-two',
            ] == [source.url for source in _flourish.sources.all()]
Пример #3
0
    def test_multiple_option_prefixed_sources(self):
        with pytest.warns(None) as _warnings:
            _flourish = Flourish('tests/source')
            assert len(_warnings) == 2
            assert _flourish.sources.count() == 7

            _flourish.canonical_source_url(
                '/#tag/#slug',
                None
            )

            assert [
                '/basic-page/basic-page',
                None,
                '/basically/thing-one',
                '/basically/thing-two',
                '/series/series/part-one',
                '/three/series/part-three',
                '/series/series/part-two',
            ] == [source.url for source in _flourish.sources.all()]
Пример #4
0
    def test_category_prefixed_sources(self):
        with pytest.warns(None) as _warnings:
            _flourish = Flourish('tests/source')
            assert len(_warnings) == 2
            assert _flourish.sources.count() == 7

            _flourish.canonical_source_url(
                '/#category/#slug',
                None
            )

            assert [
                '/static/basic-page',
                '/post/markdown-page',
                '/thing/thing-one',
                '/thing/thing-two',
                '/article/series/part-one',
                '/article/series/part-three',
                '/article/series/part-two',
            ] == [source.url for source in _flourish.sources.all()]