mirror of
https://github.com/vastsa/FileCodeBox.git
synced 2026-11-21 22:47:13 +08:00
- tests/helpers.py: SettingsOverrideMixin + init_memory_db()/close_db() - tests/conftest.py: httpx ASGI client fixtures (db, client, initialized_client) - enable pytest asyncio_mode=auto - replace 6 duplicated SettingsOverrideMixin copies and 4 duplicated Tortoise.init blocks across the legacy unittest suite
28 lines
843 B
Python
28 lines
843 B
Python
import unittest
|
|
|
|
from core.storage import S3FileStorage
|
|
|
|
|
|
from tests.helpers import SettingsOverrideMixin
|
|
|
|
|
|
class S3StorageConfigTests(SettingsOverrideMixin, unittest.TestCase):
|
|
def test_client_config_uses_path_style_when_configured(self):
|
|
storage = S3FileStorage.__new__(S3FileStorage)
|
|
storage.signature_version = "s3v4"
|
|
storage.addressing_style = "path"
|
|
|
|
config = storage._client_config()
|
|
|
|
self.assertEqual(config.signature_version, "s3v4")
|
|
self.assertEqual(config.s3["addressing_style"], "path")
|
|
|
|
def test_client_config_ignores_invalid_addressing_style(self):
|
|
storage = S3FileStorage.__new__(S3FileStorage)
|
|
storage.signature_version = "s3v4"
|
|
storage.addressing_style = "invalid"
|
|
|
|
config = storage._client_config()
|
|
|
|
self.assertIsNone(config.s3)
|