mirror of
https://github.com/GSA/notifications-admin.git
synced 2026-04-27 12:40:55 -04:00
Fix asset path in asset fingeprinter
The asset fingerprinter was hard coded to always point to `/static`. It needs to change depending on which environment the app is running in.
This commit is contained in:
@@ -103,6 +103,7 @@ def create_app(application):
|
||||
notify_environment = os.environ['NOTIFY_ENVIRONMENT']
|
||||
|
||||
application.config.from_object(configs[notify_environment])
|
||||
asset_fingerprinter._asset_root = application.config['ASSET_PATH']
|
||||
|
||||
init_app(application)
|
||||
antivirus_client.init_app(application)
|
||||
|
||||
@@ -113,6 +113,7 @@ class Test(Development):
|
||||
ANTIVIRUS_API_KEY = 'test-antivirus-secret'
|
||||
|
||||
ASSET_DOMAIN = 'static.example.com'
|
||||
ASSET_PATH = 'https://static.example.com/'
|
||||
|
||||
|
||||
class Preview(Config):
|
||||
|
||||
@@ -241,3 +241,18 @@ def test_terms_tells_logged_in_users_what_we_know_about_their_agreement(
|
||||
else:
|
||||
assert not terms_page.select_one('main p').select('a')
|
||||
assert normalize_spaces(pricing_page.select('main p')[-1].text) == expected_pricing_paragraph
|
||||
|
||||
|
||||
def test_css_is_served_from_correct_path(client_request):
|
||||
|
||||
page = client_request.get('main.pricing') # easy static page
|
||||
|
||||
for index, link in enumerate(
|
||||
page.select('link[rel=stylesheet]')
|
||||
):
|
||||
assert link['href'].startswith([
|
||||
'https://static.example.com/stylesheets/govuk-template.css?',
|
||||
'https://static.example.com/stylesheets/govuk-template-print.css?',
|
||||
'https://static.example.com/stylesheets/fonts.css?',
|
||||
'https://static.example.com/stylesheets/main.css?',
|
||||
][index])
|
||||
|
||||
Reference in New Issue
Block a user