@@ -0,0 +1,1973 @@
+import html%0Aimport json%0Aimport pytest%0Aimport re%0A%0Afrom django.contrib.contenttypes.models import ContentType%0A%0Afrom adhocracy4.test import helpers%0A%0A%0Adef react_reports_render_template(template, rf, question):%0A    request = rf.get('/')%0A    template = '%7B%25 load react_reports %25%7D' + template%0A    context = %7B'request': request, %22question%22: question%7D%0A%0A    content_type = ContentType.objects.get_for_model(question)%0A%0A    mountpoint = 'report_for_%7Bcontenttype%7D_%7Bpk%7D'.format(%0A        contenttype=content_type.id,%0A        pk=question.id%0A    )%0A    modal_name = '%7Bmountpoint%7D_modal'.format(mountpoint=mountpoint)%0A%0A    expected = (%0A        r'%5E%3Ca href=%5C%22#%7Bmodal_name%7D%5C%22 id=%5C%22%7Bmountpoint%7D%5C%22'%0A        r' data-attributes=%5C%22(?P%3Cprops%3E%7B%7B.+%7D%7D)%5C%22'%0A        r' class=%5C%22(?P%3Cclass_names%3E.*)%5C%22%3E(?P%3Ctext%3E.+)%3C/a%3E'%0A        r'%3Cscript%3Ewindow.adhocracy4.renderReports%5C(%5C'%7Bmountpoint%7D%5C'%5C)'%0A        r'%3C/script%3E$'%0A    ).format(mountpoint=mountpoint, modal_name=modal_name)%0A%0A    print(helpers.render_template(template, context))%0A    print(expected)%0A    match = re.match(expected, helpers.render_template(template, context))%0A    assert match%0A    assert match.group('props')%0A    props = json.loads(html.unescape(match.group('props')))%0A    assert props%5B'contentType'%5D == content_type.id%0A    assert props%5B'objectId'%5D == question.id%0A    assert props%5B'modalName'%5D == modal_name%0A    del props%5B'contentType'%5D%0A    del props%5B'objectId'%5D%0A    del props%5B'modalName'%5D%0A%0A    assert match.group('class_names')%0A    assert match.group('text')%0A%0A    return %7B%0A        'props': props,%0A        'class_names': html.unescape(match.group('class_names')),%0A        'text': html.unescape(match.group('text'))%0A    %7D%0A%0A%0A@pytest.mark.django_db%0Adef test_react_reports(rf, question):%0A    template = '%7B%25 react_reports question text=%22test%22 class=%22fancy class%22 %25%7D'%0A    result = react_reports_render_template(template, rf, question)%0A    assert result%5B'props'%5D == %7B%7D%0A    assert result%5B'class_names'%5D == 'fancy class'%0A    assert result%5B'text'%5D == 'test'%0A

Add tests for report_templatetags