From 5eda0def097b0e2a4db272d7f756196ba73d8aa0 Mon Sep 17 00:00:00 2001 From: Georg Krause Date: Tue, 12 Sep 2023 12:55:38 +0200 Subject: [PATCH] test(s3): Verify the construction of audio file urls with custom s3 domain Part-of: --- api/tests/music/test_utils.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/api/tests/music/test_utils.py b/api/tests/music/test_utils.py index 95c364fc2..7b4ab8e74 100644 --- a/api/tests/music/test_utils.py +++ b/api/tests/music/test_utils.py @@ -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://")