test(s3): Verify the construction of audio file urls with custom s3 domain

Part-of: <https://dev.funkwhale.audio/funkwhale/funkwhale/-/merge_requests/2577>
This commit is contained in:
Georg Krause 2023-09-12 12:55:38 +02:00 committed by Marge
parent ab7fe55b51
commit 5eda0def09
1 changed files with 10 additions and 0 deletions

View File

@ -131,3 +131,13 @@ def test_transcode_file(name, expected):
result = {k: round(v) for k, v in utils.get_audio_file_data(f).items()}
assert result == expected
def test_custom_s3_domain(factories, settings):
"""See #2220"""
settings.DEFAULT_FILE_STORAGE = "funkwhale_api.common.storage.ASCIIS3Boto3Storage"
settings.AWS_S3_CUSTOM_DOMAIN = "my.custom.domain.tld"
f = factories["music.Upload"].build(audio_file__filename="test.mp3")
print(f.audio_file.url)
assert f.audio_file.url.startswith("https://")