File tree 3 files changed +20
-0
lines changed
3 files changed +20
-0
lines changed Original file line number Diff line number Diff line change 1
1
from django .conf import settings
2
2
from django .contrib .staticfiles import finders
3
+ from django .shortcuts import render
4
+ from django .test import AsyncRequestFactory
3
5
4
6
from ..base import BaseTestCase
5
7
@@ -27,6 +29,17 @@ def test_default_case(self):
27
29
self .panel .get_staticfiles_dirs (), finders .FileSystemFinder ().locations
28
30
)
29
31
32
+ async def test_store_staticfiles_with_async_context (self ):
33
+ async def get_response (request ):
34
+ # template contains one static file
35
+ return render (request , "staticfiles/async_static.html" )
36
+
37
+ self ._get_response = get_response
38
+ async_request = AsyncRequestFactory ().get ("/" )
39
+ response = await self .panel .process_request (async_request )
40
+ self .panel .generate_stats (self .request , response )
41
+ self .assertNotEqual (self .panel .num_used , 0 )
42
+
30
43
def test_insert_content (self ):
31
44
"""
32
45
Test that the panel only inserts content after generate_stats and
Original file line number Diff line number Diff line change 2
2
< html >
3
3
< head >
4
4
< title > {{ title }}</ title >
5
+ {% block head %}{% endblock %}
5
6
</ head >
6
7
< body >
7
8
{% block content %}{% endblock %}
Original file line number Diff line number Diff line change
1
+ {% extends "base.html" %}
2
+ {% load static %}
3
+
4
+ {% block head %}
5
+ < link rel ="stylesheet " href ="{% static 'additional_static/base.css' %} ">
6
+ {% endblock %}
You can’t perform that action at this time.
0 commit comments