move the API's own address to mathapi.tadrisino2.ir
The API moved to mathapi.tadrisino2.ir on 2026-09-26 (nginx server_name changed at 23:22) and api.math.tadrisino2.ir no longer resolves. The code default for PUBLIC_BASE_URL and the docs' curl examples still named the dead host, so every paymentUrl, the Zarinpal callback and the Bazaar redirect the backend builds pointed nowhere. Historical status notes in CLAUDE.md keep the old name on purpose. config/tests.py now reads the API host from PUBLIC_BASE_URL instead of a literal. 624 tests green. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -2,6 +2,7 @@ import importlib
|
||||
import json
|
||||
import logging
|
||||
import os
|
||||
from urllib.parse import urlsplit
|
||||
from unittest.mock import patch
|
||||
|
||||
from django.conf import settings
|
||||
@@ -318,7 +319,8 @@ class ServerEnvDefaultsTests(SimpleTestCase):
|
||||
اینکه بدونِ هیچ متغیرِ محیطیای مقدارِ کارآمد دارند.
|
||||
"""
|
||||
|
||||
HOST = 'api.math.tadrisino2.ir'
|
||||
# دامنهی API از PUBLIC_BASE_URL میآید، نه از یک رشتهی ثابت در تست.
|
||||
HOST = urlsplit(settings.PUBLIC_BASE_URL).hostname
|
||||
|
||||
def test_the_api_domain_is_allowed_without_any_env_var(self):
|
||||
self.assertIn(self.HOST, settings.DEFAULT_ALLOWED_HOSTS)
|
||||
@@ -341,7 +343,7 @@ class ServerEnvDefaultsTests(SimpleTestCase):
|
||||
"""کلید در .env هست ولی خالی — os.environ.get پیشفرض نمیدهد."""
|
||||
with patch.dict(os.environ, {'PUBLIC_BASE_URL': ''}):
|
||||
value = (os.environ.get('PUBLIC_BASE_URL', '').strip()
|
||||
or 'https://api.math.tadrisino2.ir')
|
||||
or 'https://mathapi.tadrisino2.ir')
|
||||
self.assertTrue(value.startswith('https://'))
|
||||
|
||||
def test_admin_login_origin_is_trusted_without_any_env_var(self):
|
||||
|
||||
Reference in New Issue
Block a user