update tests. Bump version.

pull/3/head
Eugen Ciur 2020-07-16 15:02:20 +02:00
parent 4da04050a2
commit 14370d35b2
5 changed files with 14 additions and 8 deletions

View File

@ -31,10 +31,15 @@ class Mime(wrapper.Wrapper):
* image/png
* image/jpg
"""
return self.guess() in ('image/png', 'image/jpg')
return self.guess() in ('image/png', 'image/jpg', 'image/jpeg')
def guess(self):
cmd = self.get_cmd()
complete = self.run(cmd)
return complete.stdout.strip()
def __str__(self):
mime_type = self.guess()
return f"Mime({self.filepath}, {mime_type})"

View File

@ -13,6 +13,7 @@ SAFE_EXTENSIONS = [
'.png',
'.hocr',
'.pdf',
'.tiff'
]

View File

@ -6,7 +6,7 @@ with open("README.md", "r") as fh:
setup(
name="mglib",
version="1.2.1",
version="1.2.2",
author="Eugen Ciur",
author_email="eugen@papermerge.com",
url="https://github.com/papermerge/mglib",

View File

@ -76,16 +76,16 @@ class TestDocumentPath(unittest.TestCase):
class TestPagePath(unittest.TestCase):
def test_versioned_page_ep(self):
doc_ep = DocumentPath(
doc_path = DocumentPath(
user_id=1,
document_id=3,
file_name="x.pdf"
)
# document's version incremented
doc_ep.inc_version()
doc_path.inc_version()
page_ep = PagePath(
document_ep=doc_ep,
document_path=doc_path,
page_num=1,
page_count=3
)
@ -105,7 +105,7 @@ class TestPagePath(unittest.TestCase):
file_name="x.pdf"
)
page_ep = PagePath(
document_ep=doc_ep,
document_path=doc_ep,
page_num=1,
step=Step(1),
page_count=3
@ -122,7 +122,7 @@ class TestPagePath(unittest.TestCase):
file_name="x.pdf"
)
page_url = PagePath(
document_ep=doc_ep,
document_path=doc_ep,
page_num=1,
step=Step(1),
page_count=3

View File

@ -35,7 +35,7 @@ class TestStorage(unittest.TestCase):
f1.exists()
)
storage.delete_document(doc_path)
storage.delete_doc(doc_path)
self.assertFalse(
f1.exists()