mirror of
https://github.com/ansible/awx.git
synced 2026-03-04 18:21:03 -03:30
avoid error in templating error
This commit is contained in:
@@ -16,6 +16,9 @@ from awx.api.views import (
|
|||||||
from awx.main.models import (
|
from awx.main.models import (
|
||||||
Host,
|
Host,
|
||||||
)
|
)
|
||||||
|
from awx.main.views import handle_error
|
||||||
|
|
||||||
|
from rest_framework.test import APIRequestFactory
|
||||||
|
|
||||||
|
|
||||||
@pytest.fixture
|
@pytest.fixture
|
||||||
@@ -25,6 +28,12 @@ def mock_response_new(mocker):
|
|||||||
return m
|
return m
|
||||||
|
|
||||||
|
|
||||||
|
def test_handle_error():
|
||||||
|
# Assure that templating of error does not raise errors
|
||||||
|
request = APIRequestFactory().get('/fooooo/')
|
||||||
|
handle_error(request)
|
||||||
|
|
||||||
|
|
||||||
class TestApiRootView:
|
class TestApiRootView:
|
||||||
def test_get_endpoints(self, mocker, mock_response_new):
|
def test_get_endpoints(self, mocker, mock_response_new):
|
||||||
endpoints = [
|
endpoints = [
|
||||||
|
|||||||
@@ -157,8 +157,8 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="response-info" aria-label="{% trans "response info" %}">
|
<div class="response-info" aria-label="{% trans "response info" %}">
|
||||||
<pre class="prettyprint"><span class="meta nocode"><b>HTTP {{ response.status_code }} {{ response.status_text }}</b>{% autoescape off %}{% for key, val in response_headers|items %}
|
<pre class="prettyprint"><span class="meta nocode"><b>HTTP {{ response.status_code }} {{ response.status_text }}</b>{% autoescape off %}{% if response_headers %}{% for key, val in response_headers|items %}
|
||||||
<b>{{ key }}:</b> <span class="lit">{{ val|break_long_headers|urlize_quoted_links }}</span>{% endfor %}
|
<b>{{ key }}:</b> <span class="lit">{{ val|break_long_headers|urlize_quoted_links }}</span>{% endfor %}{% endif %}
|
||||||
{# Original line below had the side effect of also escaping content: #}
|
{# Original line below had the side effect of also escaping content: #}
|
||||||
{# </span>{{ content|urlize_quoted_links }}</pre>{% endautoescape %} #}
|
{# </span>{{ content|urlize_quoted_links }}</pre>{% endautoescape %} #}
|
||||||
{# For AWX, disable automatic URL creation and move content outside of autoescape off block. #}
|
{# For AWX, disable automatic URL creation and move content outside of autoescape off block. #}
|
||||||
|
|||||||
Reference in New Issue
Block a user