Skip to content
Snippets Groups Projects
Unverified Commit da140357 authored by sdementen's avatar sdementen Committed by GitHub
Browse files

fix #328 by: (#329)


- converting initial_arguments given as json string into a dict in `store_initial_arguments`
- add in the test of the template tag a call to the _dash-layout to ensure the initial_arguments are parsed properly

Co-authored-by: default avatarGFJ138 <sebastien.dementen@engie.com>
parent 2a567427
No related branches found
No related tags found
No related merge requests found
......@@ -22,11 +22,12 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
'''
import re
import pytest
from django.urls import reverse
@pytest.mark.django_db
def test_template_tag_use(client):
'Check use of template tag'
......@@ -39,6 +40,11 @@ def test_template_tag_use(client):
assert response.content
assert response.status_code == 200
for src in re.findall('iframe src="(.*?)"', response.content.decode("utf-8")):
response = client.get(src + "_dash-layout")
assert response.status_code == 200, ""
@pytest.mark.django_db
def test_add_to_session(client):
'Check use of session variable access helper'
......
......@@ -22,7 +22,7 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
'''
import json
import uuid
from django.conf import settings
......@@ -75,6 +75,10 @@ def store_initial_arguments(request, initial_arguments=None):
if initial_arguments is None:
return None
# convert to dict is json string
if isinstance(initial_arguments, str):
initial_arguments = json.loads(initial_arguments)
# Generate a cache id
cache_id = "dpd-initial-args-%s" % str(uuid.uuid4()).replace('-', '')
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment