Commit cde48076 authored by Dom Sekotill's avatar Dom Sekotill
Browse files

Merge branch '20-fix-remove-favicon-ico-intercept-in-nginx' into 'develop'

Remove favicon.ico intercept in Nginx

See merge request !26
parents b64662db f9252dae
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -96,4 +96,4 @@ repos:
    args: ["--config-file=.lint.cfg"]
    additional_dependencies:
    - types-requests
    - git+https://code.kodo.org.uk/dom/behave-utils.git@v0.2#behave-utils
    - behave-utils ~=0.3.2
+0 −5
Original line number Diff line number Diff line
@@ -49,11 +49,6 @@ server {
		access_log off;
	}

	# Don't return 200 for a missing favicon
	location = /favicon.ico {
		try_files favicon.ico =404;
	}

	# Don't delegate to index.php for /.well-known/
	# If a plugin wants to handle /.well-known/ URIs please submit an issue to
	# https://code.kodo.org.uk/singing-chimes.co.uk/wordpress/
+15 −0
Original line number Diff line number Diff line
Feature: Return favicons when requests
	Regression check for "#20": Fix/remove favicon.ico intercept in Nginx

	An icon should always be served when requesting "/favicon.ico", either one
	added by the owner, or a default icon.

	Scenario: Default icon
		When /favicon.ico is requested
		Then 302 is returned
		And the "Location" header's value is "http://test.example.com/wp-includes/images/w-logo-blue-white-bg.png"

	Scenario: Owner supplied icon
		Given /app/static/favicon.ico exists in the frontend
		When /favicon.ico is requested
		Then 200 is returned
+1 −1
Original line number Diff line number Diff line
Python ~=3.9; python_version < '3.9'

behave
git+https://code.kodo.org.uk/dom/behave-utils.git@v0.2#behave-utils
behave-utils ~=0.3.2
requests ~=2.26
+5 −1
Original line number Diff line number Diff line
#  Copyright 2021  Dominik Sekotill <dom.sekotill@kodo.org.uk>
#  Copyright 2021-2022  Dominik Sekotill <dom.sekotill@kodo.org.uk>
#
#  This Source Code Form is subject to the terms of the Mozilla Public
#  License, v. 2.0. If a copy of the MPL was not distributed with this
@@ -19,6 +19,8 @@ from behave.runner import Context
from behave_utils import URL
from behave_utils import PatternEnum

SAMPLE_SITE_NAME = "http://test.example.com"


class Method(PatternEnum):
	"""
@@ -120,6 +122,8 @@ def assert_header(context: Context, header_name: str, header_value: str) -> None
	"""
	Assert that an expected header was received during a previous step
	"""
	if SAMPLE_SITE_NAME in header_value:
		header_value = header_value.replace(SAMPLE_SITE_NAME, context.site.url)
	headers = context.response.headers
	assert header_name in headers, \
		f"Expected header not found in response: {header_name!r}"
Loading