mirror of https://github.com/papermerge/mglib
update tests. Bump version.
parent
4da04050a2
commit
14370d35b2
|
@ -31,10 +31,15 @@ class Mime(wrapper.Wrapper):
|
||||||
* image/png
|
* image/png
|
||||||
* image/jpg
|
* image/jpg
|
||||||
"""
|
"""
|
||||||
return self.guess() in ('image/png', 'image/jpg')
|
return self.guess() in ('image/png', 'image/jpg', 'image/jpeg')
|
||||||
|
|
||||||
def guess(self):
|
def guess(self):
|
||||||
cmd = self.get_cmd()
|
cmd = self.get_cmd()
|
||||||
complete = self.run(cmd)
|
complete = self.run(cmd)
|
||||||
|
|
||||||
return complete.stdout.strip()
|
return complete.stdout.strip()
|
||||||
|
|
||||||
|
def __str__(self):
|
||||||
|
|
||||||
|
mime_type = self.guess()
|
||||||
|
return f"Mime({self.filepath}, {mime_type})"
|
||||||
|
|
|
@ -13,6 +13,7 @@ SAFE_EXTENSIONS = [
|
||||||
'.png',
|
'.png',
|
||||||
'.hocr',
|
'.hocr',
|
||||||
'.pdf',
|
'.pdf',
|
||||||
|
'.tiff'
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|
||||||
|
|
2
setup.py
2
setup.py
|
@ -6,7 +6,7 @@ with open("README.md", "r") as fh:
|
||||||
|
|
||||||
setup(
|
setup(
|
||||||
name="mglib",
|
name="mglib",
|
||||||
version="1.2.1",
|
version="1.2.2",
|
||||||
author="Eugen Ciur",
|
author="Eugen Ciur",
|
||||||
author_email="eugen@papermerge.com",
|
author_email="eugen@papermerge.com",
|
||||||
url="https://github.com/papermerge/mglib",
|
url="https://github.com/papermerge/mglib",
|
||||||
|
|
|
@ -76,16 +76,16 @@ class TestDocumentPath(unittest.TestCase):
|
||||||
class TestPagePath(unittest.TestCase):
|
class TestPagePath(unittest.TestCase):
|
||||||
|
|
||||||
def test_versioned_page_ep(self):
|
def test_versioned_page_ep(self):
|
||||||
doc_ep = DocumentPath(
|
doc_path = DocumentPath(
|
||||||
user_id=1,
|
user_id=1,
|
||||||
document_id=3,
|
document_id=3,
|
||||||
file_name="x.pdf"
|
file_name="x.pdf"
|
||||||
)
|
)
|
||||||
# document's version incremented
|
# document's version incremented
|
||||||
doc_ep.inc_version()
|
doc_path.inc_version()
|
||||||
|
|
||||||
page_ep = PagePath(
|
page_ep = PagePath(
|
||||||
document_ep=doc_ep,
|
document_path=doc_path,
|
||||||
page_num=1,
|
page_num=1,
|
||||||
page_count=3
|
page_count=3
|
||||||
)
|
)
|
||||||
|
@ -105,7 +105,7 @@ class TestPagePath(unittest.TestCase):
|
||||||
file_name="x.pdf"
|
file_name="x.pdf"
|
||||||
)
|
)
|
||||||
page_ep = PagePath(
|
page_ep = PagePath(
|
||||||
document_ep=doc_ep,
|
document_path=doc_ep,
|
||||||
page_num=1,
|
page_num=1,
|
||||||
step=Step(1),
|
step=Step(1),
|
||||||
page_count=3
|
page_count=3
|
||||||
|
@ -122,7 +122,7 @@ class TestPagePath(unittest.TestCase):
|
||||||
file_name="x.pdf"
|
file_name="x.pdf"
|
||||||
)
|
)
|
||||||
page_url = PagePath(
|
page_url = PagePath(
|
||||||
document_ep=doc_ep,
|
document_path=doc_ep,
|
||||||
page_num=1,
|
page_num=1,
|
||||||
step=Step(1),
|
step=Step(1),
|
||||||
page_count=3
|
page_count=3
|
||||||
|
|
|
@ -35,7 +35,7 @@ class TestStorage(unittest.TestCase):
|
||||||
f1.exists()
|
f1.exists()
|
||||||
)
|
)
|
||||||
|
|
||||||
storage.delete_document(doc_path)
|
storage.delete_doc(doc_path)
|
||||||
|
|
||||||
self.assertFalse(
|
self.assertFalse(
|
||||||
f1.exists()
|
f1.exists()
|
||||||
|
|
Loading…
Reference in New Issue