mirror of
https://github.com/zedeus/nitter
synced 2026-09-05 14:49:32 +00:00
Set CI hostname to localhost for oEmbed tests
This commit is contained in:
parent
06e59f0615
commit
f74b2282be
2 changed files with 1 additions and 4 deletions
1
.github/workflows/run-tests.yml
vendored
1
.github/workflows/run-tests.yml
vendored
|
|
@ -137,6 +137,7 @@ jobs:
|
||||||
cp nitter.example.conf nitter.conf
|
cp nitter.example.conf nitter.conf
|
||||||
sed -i 's/enableDebug = false/enableDebug = true/g' 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/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/rendermd.nim
|
||||||
nim r tools/gencss.nim
|
nim r tools/gencss.nim
|
||||||
|
|
|
||||||
|
|
@ -245,15 +245,11 @@ class OEmbedDiscoveryTest(BaseTestCase):
|
||||||
def test_oembed_discovery_roundtrip(self):
|
def test_oembed_discovery_roundtrip(self):
|
||||||
"""Fetch a tweet page, extract oEmbed URL, call it, verify response."""
|
"""Fetch a tweet page, extract oEmbed URL, call it, verify response."""
|
||||||
import re
|
import re
|
||||||
from urllib.parse import urlparse
|
|
||||||
resp = requests.get(f'{self.base_url}/elonmusk/status/1141367104702038016')
|
resp = requests.get(f'{self.base_url}/elonmusk/status/1141367104702038016')
|
||||||
match = re.search(
|
match = re.search(
|
||||||
r'type="application/json\+oembed"\s+href="([^"]*)"', resp.text)
|
r'type="application/json\+oembed"\s+href="([^"]*)"', resp.text)
|
||||||
self.assertIsNotNone(match, "No oEmbed discovery link found in page")
|
self.assertIsNotNone(match, "No oEmbed discovery link found in page")
|
||||||
oembed_url = match.group(1).replace('&', '&')
|
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)
|
oembed_resp = requests.get(oembed_url)
|
||||||
self.assertEqual(oembed_resp.status_code, 200)
|
self.assertEqual(oembed_resp.status_code, 200)
|
||||||
data = oembed_resp.json()
|
data = oembed_resp.json()
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue