- texifier = PandocTexifier('pandoc')
- with DirectFetcher(TIMEOUT) as f:
- with open("test.tex", 'wb') as out:
- paperdoorknob.process(
- f"http://localhost:{self._port}", f, texifier, out)
- subprocess.run(['pdflatex', 'test.tex'],
- stdin=subprocess.DEVNULL, check=True)
+ with open("test.tex", 'wb') as out:
+ spec = Spec(
+ self.url(),
+ self.fetcher(),
+ lambda x: x,
+ lambda x: ApplyDOMFilters('NoEdit,NoFooter', x),
+ PandocTexifier('pandoc'),
+ None,
+ out)
+ paperdoorknob.process(spec)
+ subprocess.run(['pdflatex', 'test.tex'],
+ stdin=subprocess.DEVNULL, check=True)
+
+
+class TestProcessFromWebserver(BaseTestProcess, unittest.TestCase):
+
+ def setUp(self) -> None:
+ self._fetcher = self.enterContext(DirectFetcher(TIMEOUT))
+ self._server = self.enterContext(FakeGlowficServer())
+ self._port = self._server.port()
+
+ def url(self) -> str:
+ return f"http://localhost:{self._port}"
+
+ def fetcher(self) -> Fetcher:
+ return self._fetcher
+
+
+class TestProcessFromFakeFetcher(BaseTestProcess, unittest.TestCase):
+
+ def url(self) -> str:
+ return 'fic'
+
+ def fetcher(self) -> Fetcher:
+ with open('testdata/this-is-glowfic.html', 'rb') as f:
+ return FakeFetcher({'fic': f.read(9999)})