46 lines
1.5 KiB
Python
46 lines
1.5 KiB
Python
"""
|
|
Unit tests for Bunny.net storage URL generation
|
|
"""
|
|
|
|
import pytest
|
|
from src.deployment.bunny_storage import BunnyStorageClient
|
|
|
|
|
|
class TestBunnyStorageURLGeneration:
|
|
"""Test region-specific URL generation"""
|
|
|
|
def test_de_region_no_prefix(self):
|
|
"""Test that DE region uses storage.bunnycdn.com without prefix"""
|
|
client = BunnyStorageClient()
|
|
url = client._get_storage_url("DE")
|
|
assert url == "https://storage.bunnycdn.com"
|
|
|
|
def test_de_lowercase_no_prefix(self):
|
|
"""Test that lowercase 'de' also works"""
|
|
client = BunnyStorageClient()
|
|
url = client._get_storage_url("de")
|
|
assert url == "https://storage.bunnycdn.com"
|
|
|
|
def test_la_region_with_prefix(self):
|
|
"""Test that LA region uses la.storage.bunnycdn.com"""
|
|
client = BunnyStorageClient()
|
|
url = client._get_storage_url("LA")
|
|
assert url == "https://la.storage.bunnycdn.com"
|
|
|
|
def test_ny_region_with_prefix(self):
|
|
"""Test that NY region uses ny.storage.bunnycdn.com"""
|
|
client = BunnyStorageClient()
|
|
url = client._get_storage_url("NY")
|
|
assert url == "https://ny.storage.bunnycdn.com"
|
|
|
|
def test_sg_region_with_prefix(self):
|
|
"""Test that SG region uses sg.storage.bunnycdn.com"""
|
|
client = BunnyStorageClient()
|
|
url = client._get_storage_url("SG")
|
|
assert url == "https://sg.storage.bunnycdn.com"
|
|
|
|
|
|
if __name__ == "__main__":
|
|
pytest.main([__file__, "-v"])
|
|
|