Initial commit

This commit is contained in:
2025-11-18 03:36:49 +08:00
commit d17c7efb3c
7078 changed files with 831480 additions and 0 deletions

26
core/tests.py Normal file
View File

@@ -0,0 +1,26 @@
from django.test import TestCase
# Create your tests here.
from django.test import TestCase
from django.utils import timezone
from core.utils import bytes_to_gb
from core.goedge_client import GoEdgeClient
class UtilsTests(TestCase):
def test_bytes_to_gb(self):
self.assertEqual(bytes_to_gb(0), 0)
self.assertEqual(bytes_to_gb(1024 ** 3), 1)
self.assertEqual(bytes_to_gb(5 * (1024 ** 3)), 5)
class GoEdgeClientTests(TestCase):
def test_validate_base_url_invalid(self):
client = None
try:
client = GoEdgeClient()
except RuntimeError:
client = None
# 若环境未配置 base_urlGoEdgeClient 构造将抛错,此处仅断言不会引发测试崩溃
self.assertIsNone(client)