Skip to content

Commit

Permalink
fix(test): fix mimetype issue with test for b64 encoding
Browse files Browse the repository at this point in the history
  • Loading branch information
roedoejet committed Oct 5, 2021
1 parent 53ffcfb commit c25502a
Showing 1 changed file with 8 additions and 12 deletions.
20 changes: 8 additions & 12 deletions test/test_align_cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import io
import os
import re
import tempfile
from os.path import exists, join
from unittest import TestCase, main
Expand Down Expand Up @@ -146,20 +147,15 @@ def test_invoke_align(self):
with open(join(output, "html", "html.html"), "rb") as fhtml:
path_bytes = fhtml.read()
htmldoc = fromstring(path_bytes)
self.assertTrue(
htmldoc.body.xpath("//read-along")[0]
.attrib["text"]
.startswith("data:application/xml;base64,")
b64_pattern = r"data:[\w\/\+]*;base64,\w*"
self.assertRegex(
htmldoc.body.xpath("//read-along")[0].attrib["text"], b64_pattern
)
self.assertTrue(
htmldoc.body.xpath("//read-along")[0]
.attrib["alignment"]
.startswith("data:application/smil+xml;base64,")
self.assertRegex(
htmldoc.body.xpath("//read-along")[0].attrib["alignment"], b64_pattern
)
self.assertTrue(
htmldoc.body.xpath("//read-along")[0]
.attrib["audio"]
.startswith("data:audio/mp4;base64,")
self.assertRegex(
htmldoc.body.xpath("//read-along")[0].attrib["audio"], b64_pattern
)

# Functionally the same as self.assertTrue(filecmp.cmp(f1, f2)), but show where
Expand Down

0 comments on commit c25502a

Please sign in to comment.