Serve the versioned PDF from CV actions
This commit is contained in:
parent
97fbe5e825
commit
0d682bd9af
|
|
@ -101,8 +101,12 @@ $recruiterKeys = [
|
|||
<?php echo $text['job_title']; ?>
|
||||
</p>
|
||||
<p><a href="mailto:juvenaldiaz522@gmail.com">juvenaldiaz522@gmail.com</a> · <a href="tel:+524492176833">+52 449 217 6833</a></p>
|
||||
<a href="<?php echo asset_url('Juvenal-Diaz-CV.pdf'); ?>" download><?php echo htmlspecialchars($text['cv_download']); ?></a>
|
||||
<button type="button" class="cv-print-button" onclick="window.print()"><?php echo htmlspecialchars($text['cv_print']); ?></button>
|
||||
<a href="<?php echo asset_url('/Juvenal-Diaz-CV.pdf'); ?>"
|
||||
download="Juvenal-Diaz-CV.pdf"><?php echo htmlspecialchars($text['cv_download']); ?></a>
|
||||
<a class="cv-print-button"
|
||||
href="<?php echo asset_url('/Juvenal-Diaz-CV.pdf'); ?>"
|
||||
target="_blank"
|
||||
rel="noopener"><?php echo htmlspecialchars($text['cv_print']); ?></a>
|
||||
</div>
|
||||
|
||||
<h2 data-translate data-key="cv_summary_title"
|
||||
|
|
|
|||
|
|
@ -0,0 +1,24 @@
|
|||
import unittest
|
||||
from pathlib import Path
|
||||
|
||||
|
||||
ROOT = Path(__file__).resolve().parents[2]
|
||||
WEBSITE = ROOT / "apps" / "website"
|
||||
|
||||
|
||||
class WebsiteCVTests(unittest.TestCase):
|
||||
def test_versioned_cv_is_a_pdf_asset(self):
|
||||
pdf = WEBSITE / "Juvenal-Diaz-CV.pdf"
|
||||
self.assertGreater(pdf.stat().st_size, 1024)
|
||||
self.assertEqual(pdf.read_bytes()[:5], b"%PDF-")
|
||||
|
||||
def test_cv_actions_use_the_pdf_instead_of_printing_the_web_page(self):
|
||||
page = (WEBSITE / "cv.php").read_text()
|
||||
self.assertEqual(page.count("asset_url('/Juvenal-Diaz-CV.pdf')"), 2)
|
||||
self.assertIn('download="Juvenal-Diaz-CV.pdf"', page)
|
||||
self.assertIn('target="_blank"', page)
|
||||
self.assertNotIn("window.print()", page)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
unittest.main()
|
||||
Loading…
Reference in New Issue