mirror of
https://github.com/jhd3197/ServerKit.git
synced 2026-11-30 04:05:58 +09:00
The /api/v1/email/dns-providers routes lived only in the serverkit-email extension, so panels without it (email is gated to mail users) got a 404/405 from the Settings -> Connections DNS tiles. The service was already core; the routes now are too, at the same historical paths. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
34 lines
1.4 KiB
Python
34 lines
1.4 KiB
Python
"""Proving tests: DNS provider connections are core, not extension-owned.
|
|
|
|
The /api/v1/email/dns-providers routes used to live only in the serverkit-email
|
|
extension, so a panel without it (email is gated to mail users) got a 404/405
|
|
from the Settings -> Connections DNS tiles — surfaced as a bare "Request
|
|
failed". These prove the routes exist in the core app with no plugins loaded.
|
|
"""
|
|
|
|
|
|
def test_list_dns_providers_without_email_extension(client, auth_headers):
|
|
resp = client.get('/api/v1/email/dns-providers', headers=auth_headers)
|
|
assert resp.status_code == 200
|
|
assert resp.get_json() == {'providers': []}
|
|
|
|
|
|
def test_add_dns_provider_without_email_extension(client, auth_headers):
|
|
resp = client.post('/api/v1/email/dns-providers', headers=auth_headers, json={
|
|
'name': 'cf', 'provider': 'cloudflare', 'api_key': 'tok',
|
|
})
|
|
assert resp.status_code == 201
|
|
body = resp.get_json()
|
|
assert body.get('success') is True
|
|
|
|
resp = client.get('/api/v1/email/dns-providers', headers=auth_headers)
|
|
providers = resp.get_json()['providers']
|
|
assert len(providers) == 1 and providers[0]['name'] == 'cf'
|
|
|
|
|
|
def test_add_dns_provider_validates_payload(client, auth_headers):
|
|
resp = client.post('/api/v1/email/dns-providers', headers=auth_headers,
|
|
json={'name': 'cf'})
|
|
assert resp.status_code == 400
|
|
assert 'required' in resp.get_json()['error']
|