mirror of
https://github.com/jrnl-org/jrnl.git
synced 2025-05-10 16:48:31 +02:00
test that data folder (for images) is created
This commit is contained in:
parent
d323e5f131
commit
754a2d27ee
1 changed files with 15 additions and 9 deletions
|
@ -13,13 +13,15 @@ class TestClasses(unittest.TestCase):
|
||||||
"""
|
"""
|
||||||
|
|
||||||
def setUp(self):
|
def setUp(self):
|
||||||
self.data_path = os.path.dirname(os.path.abspath(__file__))
|
self.test_data_path = os.path.dirname(os.path.abspath(__file__))
|
||||||
self.config = {
|
self.config = {
|
||||||
"timeformat": "%Y-%m-%d %H:%M",
|
"timeformat": "%Y-%m-%d %H:%M",
|
||||||
"encrypt": False,
|
"encrypt": False,
|
||||||
"tagsymbols": "@",
|
"tagsymbols": "@",
|
||||||
"journal": ""
|
"journal": ""
|
||||||
}
|
}
|
||||||
|
self.config['journal'] = os.path.join(self.test_data_path, 'empty.txt')
|
||||||
|
self.journal = Journal(config=self.config)
|
||||||
|
|
||||||
def tearDown(self):
|
def tearDown(self):
|
||||||
# TODO: delete copied file, etc
|
# TODO: delete copied file, etc
|
||||||
|
@ -29,12 +31,16 @@ class TestClasses(unittest.TestCase):
|
||||||
"""colons should not cause problems in the text body"""
|
"""colons should not cause problems in the text body"""
|
||||||
pass
|
pass
|
||||||
|
|
||||||
# def test_file_detection(self):
|
def test_data_folder_exists(self):
|
||||||
# self.config['journal'] = os.path.join(self.data_path, 'empty.txt')
|
self.assertTrue(os.path.exists(self.journal.data_path))
|
||||||
# journal = Journal(config=self.config)
|
self.assertTrue(os.path.isdir(self.journal.data_path))
|
||||||
# with open(os.path.join(self.data_path, 'url_test.txt')) as f:
|
|
||||||
# journal.new_entry(f.read())
|
def test_file_copied(self):
|
||||||
# # TODO: check that copied file exists
|
self.assertTrue(len(os.list))
|
||||||
|
with open(os.path.join(self.test_data_path, 'url_test.txt')) as f:
|
||||||
|
journal.new_entry(f.read())
|
||||||
|
# TODO: check that copied file exists
|
||||||
|
|
||||||
|
|
||||||
def test_rendering_md(self):
|
def test_rendering_md(self):
|
||||||
pass
|
pass
|
||||||
|
@ -51,9 +57,9 @@ class TestClasses(unittest.TestCase):
|
||||||
'/Volumes/dedan/test.png']
|
'/Volumes/dedan/test.png']
|
||||||
false_positive = ['/Volumes/dedan/bla.blub',
|
false_positive = ['/Volumes/dedan/bla.blub',
|
||||||
'http://en.wikipedia.org/wiki/Generative_model']
|
'http://en.wikipedia.org/wiki/Generative_model']
|
||||||
self.config['journal'] = os.path.join(self.data_path, 'empty.txt')
|
self.config['journal'] = os.path.join(self.test_data_path, 'empty.txt')
|
||||||
journal = Journal(config=self.config)
|
journal = Journal(config=self.config)
|
||||||
with open(os.path.join(self.data_path, 'url_test.txt')) as f:
|
with open(os.path.join(self.test_data_path, 'url_test.txt')) as f:
|
||||||
results = [res[0] for res in journal.path_search.findall(f.read())]
|
results = [res[0] for res in journal.path_search.findall(f.read())]
|
||||||
for tp in true_positive:
|
for tp in true_positive:
|
||||||
self.assertIn(tp, results)
|
self.assertIn(tp, results)
|
||||||
|
|
Loading…
Add table
Reference in a new issue