pdf tests: use our own pdf doc as GOOD_PDF

remove non distributable good.pdf
This commit is contained in:
Alon Levy 2014-09-26 00:47:08 +03:00 committed by Christopher Allan Webber
parent a5cae60284
commit becd160703
3 changed files with 18 additions and 12 deletions

View File

@ -22,19 +22,25 @@ import pytest
from mediagoblin.media_types.pdf.processing import ( from mediagoblin.media_types.pdf.processing import (
pdf_info, check_prerequisites, create_pdf_thumb) pdf_info, check_prerequisites, create_pdf_thumb)
from .resources import GOOD_PDF as GOOD from .resources import GOOD_PDF
@pytest.mark.skipif("not check_prerequisites()") @pytest.mark.skipif("not os.path.exists(GOOD_PDF) or not check_prerequisites()")
def test_pdf(): def test_pdf():
good_dict = collections.OrderedDict({'pdf_version_major': 1, 'pdf_title': '', expected_dict = {'pdf_author': -1,
'pdf_page_size_width': 612, 'pdf_author': '', 'pdf_creator': -1,
'pdf_keywords': '', 'pdf_pages': 10, 'pdf_keywords': -1,
'pdf_producer': 'dvips + GNU Ghostscript 7.05', 'pdf_page_size_height': -1,
'pdf_version_minor': 3, 'pdf_page_size_width': -1,
'pdf_creator': 'LaTeX with hyperref package', 'pdf_pages': -1,
'pdf_page_size_height': 792}) 'pdf_producer': -1,
assert pdf_info(GOOD) == good_dict 'pdf_title': -1,
'pdf_version_major': 1,
'pdf_version_minor': -1}
good_info = pdf_info(GOOD_PDF)
for k, v in expected_dict.items():
assert(k in good_info)
assert(v == -1 or v == good_info[k])
temp_dir = tempfile.mkdtemp() temp_dir = tempfile.mkdtemp()
create_pdf_thumb(GOOD, os.path.join(temp_dir, 'good_256_256.png'), 256, 256) create_pdf_thumb(GOOD_PDF, os.path.join(temp_dir, 'good_256_256.png'), 256, 256)
shutil.rmtree(temp_dir) shutil.rmtree(temp_dir)

View File

@ -149,7 +149,7 @@ class TestSubmission:
def test_normal_png(self): def test_normal_png(self):
self.check_normal_upload(u'Normal upload 2', GOOD_PNG) self.check_normal_upload(u'Normal upload 2', GOOD_PNG)
@pytest.mark.skipif("not pdf_check_prerequisites()") @pytest.mark.skipif("not os.path.exists(GOOD_PDF) or not pdf_check_prerequisites()")
def test_normal_pdf(self): def test_normal_pdf(self):
response, context = self.do_post({'title': u'Normal upload 3 (pdf)'}, response, context = self.do_post({'title': u'Normal upload 3 (pdf)'},
do_follow=True, do_follow=True,

View File

@ -0,0 +1 @@
../../../docs/build/latex/GNUMediaGoblin.pdf