Переглянути джерело

Set CI hostname to localhost for oEmbed tests

Zed 3 тижнів тому
батько
коміт
f74b2282be
2 змінених файлів з 1 додано та 4 видалено
  1. 1 0
      .github/workflows/run-tests.yml
  2. 0 4
      tests/test_embed.py

+ 1 - 0
.github/workflows/run-tests.yml

@@ -137,6 +137,7 @@ jobs:
           cp nitter.example.conf nitter.conf
           sed -i 's/enableDebug = false/enableDebug = true/g' nitter.conf
           sed -i 's/maxRetries = 1/maxRetries = 10/g' nitter.conf
+          sed -i 's/hostname = "nitter.net"/hostname = "localhost:8080"/g' nitter.conf
 
           nim r tools/rendermd.nim
           nim r tools/gencss.nim

+ 0 - 4
tests/test_embed.py

@@ -245,15 +245,11 @@ class OEmbedDiscoveryTest(BaseTestCase):
     def test_oembed_discovery_roundtrip(self):
         """Fetch a tweet page, extract oEmbed URL, call it, verify response."""
         import re
-        from urllib.parse import urlparse
         resp = requests.get(f'{self.base_url}/elonmusk/status/1141367104702038016')
         match = re.search(
             r'type="application/json\+oembed"\s+href="([^"]*)"', resp.text)
         self.assertIsNotNone(match, "No oEmbed discovery link found in page")
         oembed_url = match.group(1).replace('&', '&')
-        # Rewrite host to base_url in case cfg.hostname differs (e.g. CI)
-        parsed = urlparse(oembed_url)
-        oembed_url = f'{self.base_url}{parsed.path}?{parsed.query}'
         oembed_resp = requests.get(oembed_url)
         self.assertEqual(oembed_resp.status_code, 200)
         data = oembed_resp.json()