]> git.scottworley.com Git - paperdoorknob/blobdiff - glowfic_test.py
next_thread should be an absolute URL
[paperdoorknob] / glowfic_test.py
index 22eea257c21d4fe4d9b7776fdd159b579a8016f8..bd26e3c9dfc5bc0ee4ec02eead21e34bdca42689 100644 (file)
@@ -103,7 +103,7 @@ class TestThread(unittest.TestCase):
             </body></html>'''))
         self.assertEqual(t.title(), 'Teh Story!')
 
-    def testNextThread(self) -> None:
+    def testNextThreadRelative(self) -> None:
         t = Thread(spec_for_testing(b'''
             <html><body>
               <div class="post-navheader">
@@ -113,7 +113,19 @@ class TestThread(unittest.TestCase):
               </div>
               <div class="post-container post-post">The "post"</div>
             </body></html>'''))
-        self.assertEqual(t.next_thread(), '/posts/4567')
+        self.assertEqual(t.next_thread(), 'https://fake/posts/4567')
+
+    def testNextThreadAbsolute(self) -> None:
+        t = Thread(spec_for_testing(b'''
+            <html><body>
+              <div class="post-navheader">
+                <a class="view-button-link" href="https://elsewhere/posts/4567"><div class="view-button">Next Post &raquo;</div>
+                </a><a class="view-button-link" href="https://elsewhere/posts/4321"><div class="view-button float-none">&laquo; Previous Post</div>
+                </a>
+              </div>
+              <div class="post-container post-post">The "post"</div>
+            </body></html>'''))
+        self.assertEqual(t.next_thread(), 'https://elsewhere/posts/4567')
 
 
 if __name__ == '__main__':