mirror of
https://github.com/jrnl-org/jrnl.git
synced 2025-05-10 16:48:31 +02:00
move test data to a data subfolder
This commit is contained in:
parent
20151ff801
commit
a1d14a71dd
5 changed files with 6 additions and 7 deletions
|
@ -255,10 +255,10 @@ class Journal:
|
||||||
for word in body.split():
|
for word in body.split():
|
||||||
res = self.path_search.match(word)
|
res = self.path_search.match(word)
|
||||||
if res and os.path.exists(res.groups()[0]):
|
if res and os.path.exists(res.groups()[0]):
|
||||||
word = word.strip('()[]')
|
im_path = res.groups()[0]
|
||||||
ext = os.path.splitext(os.path.basename(word))[1]
|
ext = os.path.splitext(os.path.basename(im_path))[1]
|
||||||
random_name = 'img_' + self._random_string() + ext
|
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
|
return body
|
||||||
|
|
||||||
def new_entry(self, raw, date=None):
|
def new_entry(self, raw, date=None):
|
||||||
|
|
Before Width: | Height: | Size: 100 KiB After Width: | Height: | Size: 100 KiB |
|
@ -6,8 +6,6 @@ import os
|
||||||
from jrnl.Journal import Journal
|
from jrnl.Journal import Journal
|
||||||
import shutil
|
import shutil
|
||||||
|
|
||||||
# TODO: move test data to a data folder
|
|
||||||
|
|
||||||
class TestClasses(unittest.TestCase):
|
class TestClasses(unittest.TestCase):
|
||||||
"""Test the behavior of the classes.
|
"""Test the behavior of the classes.
|
||||||
|
|
||||||
|
@ -16,7 +14,8 @@ class TestClasses(unittest.TestCase):
|
||||||
"""
|
"""
|
||||||
|
|
||||||
def setUp(self):
|
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 = {
|
self.config = {
|
||||||
"timeformat": "%Y-%m-%d %H:%M",
|
"timeformat": "%Y-%m-%d %H:%M",
|
||||||
"encrypt": False,
|
"encrypt": False,
|
||||||
|
@ -50,7 +49,7 @@ class TestClasses(unittest.TestCase):
|
||||||
|
|
||||||
def test_pathsearch_regex(self):
|
def test_pathsearch_regex(self):
|
||||||
true_positive = ['/Volumes/dedan/bla.png',
|
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',
|
'/Volumes/dedan/test.png',
|
||||||
'C:\\a\\windows\\file.png']
|
'C:\\a\\windows\\file.png']
|
||||||
false_positive = ['/Volumes/dedan/bla.blub',
|
false_positive = ['/Volumes/dedan/bla.blub',
|
||||||
|
|
Loading…
Add table
Reference in a new issue