move test data to a data subfolder

This commit is contained in:
Stephan Gabler 2012-07-23 10:57:52 +02:00
parent 20151ff801
commit a1d14a71dd
5 changed files with 6 additions and 7 deletions

View file

@ -255,10 +255,10 @@ class Journal:
for word in body.split():
res = self.path_search.match(word)
if res and os.path.exists(res.groups()[0]):
word = word.strip('()[]')
ext = os.path.splitext(os.path.basename(word))[1]
im_path = res.groups()[0]
ext = os.path.splitext(os.path.basename(im_path))[1]
random_name = 'img_' + self._random_string() + ext
shutil.copyfile(word, os.path.join(self.data_path, random_name))
shutil.copyfile(im_path, os.path.join(self.data_path, random_name))
return body
def new_entry(self, raw, date=None):

View file

Before

Width:  |  Height:  |  Size: 100 KiB

After

Width:  |  Height:  |  Size: 100 KiB

View file

@ -6,8 +6,6 @@ import os
from jrnl.Journal import Journal
import shutil
# TODO: move test data to a data folder
class TestClasses(unittest.TestCase):
"""Test the behavior of the classes.
@ -16,7 +14,8 @@ class TestClasses(unittest.TestCase):
"""
def setUp(self):
self.test_data_path = os.path.dirname(os.path.abspath(__file__))
self.test_data_path = os.path.join(os.path.dirname(os.path.abspath(__file__)),
'test_data')
self.config = {
"timeformat": "%Y-%m-%d %H:%M",
"encrypt": False,
@ -50,7 +49,7 @@ class TestClasses(unittest.TestCase):
def test_pathsearch_regex(self):
true_positive = ['/Volumes/dedan/bla.png',
'/Users/dedan/projects/jrnl/tests/golden.jpg',
'/Users/dedan/projects/jrnl/tests/test_data/golden.jpg',
'/Volumes/dedan/test.png',
'C:\\a\\windows\\file.png']
false_positive = ['/Volumes/dedan/bla.blub',