- def setUp(self) -> None:
- self._web_server = HTTPServer(('', 0), FakeGlowficHTTPRequestHandler)
- self._thread = threading.Thread(target=self._web_server.serve_forever)
- self._thread.start()
-
- def tearDown(self) -> None:
- self._web_server.shutdown()
- self._thread.join()
-
- def testFetch(self) -> None:
- paperdoorknob.fetch(f"http://localhost:{self._port()}", TIMEOUT)
-
- def testFetchErrors(self) -> None:
- with self.assertRaises(requests.HTTPError):
- paperdoorknob.fetch(
- f"http://localhost:{self._port()}/not_found", TIMEOUT)
- with self.assertRaises(requests.HTTPError):
- paperdoorknob.fetch(
- f"http://localhost:{self._port()}/server_error", TIMEOUT)
+ def testPDF(self) -> None:
+ with DirectFetcher(TIMEOUT) as f:
+ with open("test.tex", 'wb') as out:
+ spec = Spec(
+ f"http://localhost:{self._port}",
+ f,
+ PandocTexifier('pandoc'),
+ out)
+ paperdoorknob.process(spec)
+ subprocess.run(['pdflatex', 'test.tex'],
+ stdin=subprocess.DEVNULL, check=True)