2017-01-15 15:52:25 +01:00
|
|
|
import shutil
|
|
|
|
from unittest import TestCase
|
|
|
|
|
|
|
|
from pathlib import Path
|
|
|
|
|
|
|
|
from src.dokuwiki_to_hugo import DokuWikiToHugo
|
|
|
|
|
|
|
|
|
|
|
|
class TestDokuWikiToHugo(TestCase):
|
|
|
|
def tearDown(self):
|
|
|
|
shutil.rmtree('output')
|
2020-07-24 16:26:14 +02:00
|
|
|
pass
|
2017-01-15 17:33:15 +01:00
|
|
|
|
2017-01-16 16:37:58 +01:00
|
|
|
def test_doku_to_hugo_converts_home_to_index_markdown_files(self):
|
2020-07-24 16:26:14 +02:00
|
|
|
DokuWikiToHugo().doku_to_hugo('test/subdir')
|
|
|
|
expected = Path("output/test/subdir/_index.md").read_text()
|
2017-01-16 16:37:58 +01:00
|
|
|
|
|
|
|
self.assertIn('subdir index', expected)
|
|
|
|
|
2017-01-15 15:52:25 +01:00
|
|
|
def test_convert_whole_dir(self):
|
2020-07-24 16:26:14 +02:00
|
|
|
DokuWikiToHugo().doku_to_hugo('test/subdir')
|
|
|
|
expected = Path("output/test/subdir/moar/dokuwiki_header_in_subdir.md").read_text()
|
2017-01-15 15:52:25 +01:00
|
|
|
|
2017-01-30 16:09:23 +01:00
|
|
|
self.assertIn('+++', expected) # header is there, check
|
|
|
|
self.assertIn('##### some header', expected) # some conversion done, check
|