Make logo CDN domain into simple config

Having this as a function which does string parsing and manipulation
surprised me a bit when I was trying to figure out why something wasn’t
working.

It’s more in line with the way we do other config like this (for example
`ASSET_PATH`) to make it a simple config variable, rather than trying to
be clever and guess things based on other config variables.

It’s also less code, and is explicit enough that it doesn’t need tests.
This commit is contained in:
Chris Hill-Scott
2022-01-26 14:44:33 +00:00
parent 2224eacf6b
commit 4f672cb5dc
8 changed files with 19 additions and 40 deletions

View File

@@ -1,18 +1,6 @@
import pytest
from app.utils import get_logo_cdn_domain, merge_jsonlike
def test_get_cdn_domain_on_localhost(client_request, mocker):
mocker.patch.dict('app.current_app.config', values={'ADMIN_BASE_URL': 'http://localhost:6012'})
domain = get_logo_cdn_domain()
assert domain == 'static-logos.notify.tools'
def test_get_cdn_domain_on_non_localhost(client_request, mocker):
mocker.patch.dict('app.current_app.config', values={'ADMIN_BASE_URL': 'https://some.admintest.com'})
domain = get_logo_cdn_domain()
assert domain == 'static-logos.admintest.com'
from app.utils import merge_jsonlike
@pytest.mark.parametrize("source_object, destination_object, expected_result", [