Fix #2249 -- Broken static files with whitenoise=n & cloud_provider=none

This commit is contained in:
Caio Ariede 2019-10-02 12:03:33 -03:00
parent 4cd784ed10
commit d0c208d10f
2 changed files with 21 additions and 0 deletions

View File

@ -59,3 +59,12 @@ if "{{ cookiecutter.use_docker }}".lower() == "n":
) )
+ TERMINATOR + TERMINATOR
) )
if (
"{{ cookiecutter.use_whitenoise }}".lower() == "n"
and "{{ cookiecutter.cloud_provider }}" == "None"
):
print(
"You should either use Whitenoise or select a Cloud Provider to serve static files"
)
sys.exit(1)

View File

@ -49,6 +49,11 @@ def context_combination(
cloud_provider, cloud_provider,
): ):
"""Fixture that parametrize the function where it's used.""" """Fixture that parametrize the function where it's used."""
if cloud_provider == "None":
# Either of the two should be set for serving static files, so if cloud provider
# is not set, we force Whitenoise to be set
use_whitenoise = "y"
return { return {
"windows": windows, "windows": windows,
"use_docker": use_docker, "use_docker": use_docker,
@ -157,3 +162,10 @@ def test_invalid_slug(cookies, context, slug):
assert result.exit_code != 0 assert result.exit_code != 0
assert isinstance(result.exception, FailedHookException) assert isinstance(result.exception, FailedHookException)
def test_no_whitenoise_and_no_cloud_provider(cookies, context):
context.update({"use_whitenoise": "n", "cloud_provider": "None"})
result = cookies.bake(extra_context=context)
assert result.exit_code == 1