fix: accept custom domain field from dashboard
Build and publish Docker image / build-and-publish (push) Successful in 9s
Build and publish Docker image / build-and-publish (push) Successful in 9s
This commit is contained in:
1 parent
161a895802
commit
ef3d045a51
2 files changed
+28
-1
No files matched your search
@@ -84,6 +84,33 @@ class BackupRestoreTests(unittest.TestCase):
|
|||||||
"pvc": {"name": f"{self.server_id}-restore-test", "namespace": "user-test"},
|
"pvc": {"name": f"{self.server_id}-restore-test", "namespace": "user-test"},
|
||||||
})
|
})
|
||||||
|
|
||||||
|
def test_custom_domain_accepts_legacy_frontend_domain_name_field(self):
|
||||||
|
sent = []
|
||||||
|
|
||||||
|
async def capture_message(_client_id, message):
|
||||||
|
sent.append(message)
|
||||||
|
|
||||||
|
with (
|
||||||
|
patch.object(websocket_service, "send_message", new=AsyncMock(side_effect=capture_message)),
|
||||||
|
patch.object(
|
||||||
|
websocket_service,
|
||||||
|
"verify_domain_dns",
|
||||||
|
return_value={"verified": True, "message": "DNS points to this server"},
|
||||||
|
) as verify_domain_dns,
|
||||||
|
patch.object(
|
||||||
|
websocket_service,
|
||||||
|
"create_custom_domain_record",
|
||||||
|
return_value={"id": "domain-test", "server_id": None},
|
||||||
|
),
|
||||||
|
):
|
||||||
|
asyncio.run(websocket_service.handle_create_custom_domain(self.client_id, {
|
||||||
|
"domainName": "panel.example.com",
|
||||||
|
}))
|
||||||
|
|
||||||
|
verify_domain_dns.assert_called_once_with("panel.example.com")
|
||||||
|
self.assertTrue(any(message.get("type") == "custom_domain_created" for message in sent))
|
||||||
|
self.assertFalse(any(message.get("error") == "Domain required" for message in sent))
|
||||||
|
|
||||||
def test_restore_refuses_missing_snapshot_before_stopping_server(self):
|
def test_restore_refuses_missing_snapshot_before_stopping_server(self):
|
||||||
sent = []
|
sent = []
|
||||||
|
|
||||||
|
|||||||
@@ -3844,7 +3844,7 @@ async def handle_create_custom_domain(client_id, data):
|
|||||||
return
|
return
|
||||||
|
|
||||||
user_id = client_info['user_id']
|
user_id = client_info['user_id']
|
||||||
domain = data.get('domain')
|
domain = data.get('domain') or data.get('domainName')
|
||||||
server_id = data.get('serverId') or None
|
server_id = data.get('serverId') or None
|
||||||
|
|
||||||
if server_id:
|
if server_id:
|
||||||
|
|||||||
Reference in new issue
Block a user