]> git.scottworley.com Git - paperdoorknob/commitdiff
Move HTML test data out to separate file
authorScott Worley <scottworley@scottworley.com>
Wed, 20 Dec 2023 01:44:32 +0000 (17:44 -0800)
committerScott Worley <scottworley@scottworley.com>
Wed, 20 Dec 2023 04:11:59 +0000 (20:11 -0800)
testdata/this-is-glowfic.html [new file with mode: 0644]
testing/fakeserver.py

diff --git a/testdata/this-is-glowfic.html b/testdata/this-is-glowfic.html
new file mode 100644 (file)
index 0000000..22c7a37
--- /dev/null
@@ -0,0 +1,19 @@
+<html>
+  <body>
+    <div class="post-container post-post">
+      <div class="post-edit-box">We don't want edit boxes</div>
+      This is glowfic
+      <div class="post-footer">We don't want footers</div>
+    </div>
+    <div class="flat-post-replies">
+      <div class="post-container post-reply">
+        <div class="post-edit-box">We don't want edit boxes</div>
+        You <em>sure</em>?
+        <div class="post-footer">We don't want footers</div>
+      </div>
+      <div class="post-container post-reply">
+        Pretty sure.
+      </div>
+    </div>
+  </body>
+</html>
index 2ed8149b2dfbe41dce5e9e1e9ce61af020c607ef..bbeb52267a40ed788229575d789dc3097b186c0f 100644 (file)
@@ -16,25 +16,8 @@ class FakeGlowficHTTPRequestHandler(BaseHTTPRequestHandler):
         return 200
 
     def do_GET(self) -> None:
         return 200
 
     def do_GET(self) -> None:
-        body = b'''<html>
-  <body>
-    <div class="post-container post-post">
-      <div class="post-edit-box">We don't want edit boxes</div>
-      This is glowfic
-      <div class="post-footer">We don't want footers</div>
-    </div>
-    <div class="flat-post-replies">
-      <div class="post-container post-reply">
-        <div class="post-edit-box">We don't want edit boxes</div>
-        You <em>sure</em>?
-        <div class="post-footer">We don't want footers</div>
-      </div>
-      <div class="post-container post-reply">
-        Pretty sure.
-      </div>
-    </div>
-  </body>
-</html>'''
+        with open("testdata/this-is-glowfic.html", "rb") as f:
+            body = f.read(9999)
         self.send_response(self._response_code())
         self.send_header("Content-type", "text/html")
         self.send_header("Content-Length", str(len(body)))
         self.send_response(self._response_code())
         self.send_header("Content-type", "text/html")
         self.send_header("Content-Length", str(len(body)))