Skip to content

Commit

Permalink
Fix up unnecessarily split strings, which were a side-effect of refor…
Browse files Browse the repository at this point in the history
…matting
  • Loading branch information
stevejalim committed Jan 24, 2024
1 parent f38dd2f commit 0a83866
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
8 changes: 4 additions & 4 deletions csp/tests/test_jinja_extension.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ def test_async_attribute_with_falsey(self):
var hello='world';
{% endscript %}"""

expected = '<script nonce="{}" id="jeff" async=false>' "var hello='world';" "</script>"
expected = '<script nonce="{}" id="jeff" async=false>var hello=\'world\';</script>'

self.assert_template_eq(*self.process_templates(tpl, expected))

Expand All @@ -52,7 +52,7 @@ def test_async_attribute_with_truthy(self):
var hello='world';
{% endscript %}"""

expected = '<script nonce="{}" id="jeff" async>' "var hello='world';" "</script>"
expected = '<script nonce="{}" id="jeff" async>var hello=\'world\';</script>'

self.assert_template_eq(*self.process_templates(tpl, expected))

Expand All @@ -66,7 +66,7 @@ def test_nested_script_tags_are_removed(self):
</script>
{% endscript %}"""

expected = "<script" ' nonce="{}" id="jeff" type="application/javascript" defer>' "var hello='world';</script>"
expected = '<script nonce="{}" id="jeff" type="application/javascript" defer>var hello=\'world\';</script>'

self.assert_template_eq(*self.process_templates(tpl, expected))

Expand All @@ -82,6 +82,6 @@ def test_regex_captures_script_content_including_brackets(self):
{% endscript %}
"""

expected = '<script nonce="{}">' 'let capture_text = "<script></script>"' "</script>"
expected = '<script nonce="{}">let capture_text = "<script></script>"</script>'

self.assert_template_eq(*self.process_templates(tpl, expected))
6 changes: 3 additions & 3 deletions csp/tests/test_templatetags.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ def test_script_tag_sets_attrs_correctly(self):
var hello='world';
{% endscript %}"""

expected = "<script" ' nonce="{}" id="jeff" type="application/javascript" defer>' "var hello='world';</script>"
expected = '<script nonce="{}" id="jeff" type="application/javascript" defer>var hello=\'world\';</script>'

self.assert_template_eq(*self.process_templates(tpl, expected))

Expand Down Expand Up @@ -65,7 +65,7 @@ def test_nested_script_tags_are_removed(self):
</script>
{% endscript %}"""

expected = "<script" ' nonce="{}" id="jeff" type="application/javascript" defer>' "var hello='world';</script>"
expected = '<script nonce="{}" id="jeff" type="application/javascript" defer>var hello=\'world\';</script>'

self.assert_template_eq(*self.process_templates(tpl, expected))

Expand All @@ -82,6 +82,6 @@ def test_regex_captures_script_content_including_brackets(self):
{% endscript %}
"""

expected = '<script nonce="{}">' 'let capture_text = "<script></script>"' "</script>"
expected = '<script nonce="{}">let capture_text = "<script></script>"</script>'

self.assert_template_eq(*self.process_templates(tpl, expected))

0 comments on commit 0a83866

Please sign in to comment.