Fix: use api_base fixture instead of hardcoded pic0 IP in WG domain access tests
test_peer_services_* functions hardcoded 'http://192.168.31.51:3000' as the fallback for PIC_API_BASE, causing failures when tests run on any other host (including pic1 itself). Use the api_base fixture, which reads PIC_HOST and PIC_API_PORT from the environment. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -153,13 +153,12 @@ def test_http_api_domain_reaches_api(connected_peer, admin_client):
|
||||
|
||||
# ── Scenario 33: Config DNS field ─────────────────────────────────────────────
|
||||
|
||||
def test_peer_services_config_has_coredns_not_vpn_gateway(admin_client, make_peer):
|
||||
def test_peer_services_config_has_coredns_not_vpn_gateway(admin_client, make_peer, api_base):
|
||||
"""WireGuard config in /api/peer/services must use CoreDNS IP, not 10.0.0.1."""
|
||||
from helpers.api_client import PicAPIClient
|
||||
import os
|
||||
|
||||
peer = make_peer('e2etest-dns-config', password='DnsTest123!')
|
||||
peer_client = PicAPIClient(os.environ.get('PIC_API_BASE', 'http://192.168.31.51:3000'))
|
||||
peer_client = PicAPIClient(api_base)
|
||||
peer_client.login(peer['name'], 'DnsTest123!')
|
||||
|
||||
r = peer_client.get('/api/peer/services')
|
||||
@@ -188,14 +187,13 @@ def test_peer_services_config_has_coredns_not_vpn_gateway(admin_client, make_pee
|
||||
break
|
||||
|
||||
|
||||
def test_peer_services_caldav_url_uses_configured_domain(admin_client, make_peer):
|
||||
def test_peer_services_caldav_url_uses_configured_domain(admin_client, make_peer, api_base):
|
||||
"""CalDAV URL must use the configured domain, not hardcode 'radicale.dev:5232'."""
|
||||
from helpers.api_client import PicAPIClient
|
||||
import os
|
||||
|
||||
dom = _domain(admin_client)
|
||||
peer = make_peer('e2etest-caldav-url', password='CaldavTest123!')
|
||||
peer_client = PicAPIClient(os.environ.get('PIC_API_BASE', 'http://192.168.31.51:3000'))
|
||||
peer_client = PicAPIClient(api_base)
|
||||
peer_client.login(peer['name'], 'CaldavTest123!')
|
||||
|
||||
r = peer_client.get('/api/peer/services')
|
||||
|
||||
Reference in New Issue
Block a user