Skip to content

Commit

Permalink
Fold in code suggestion from PR#199
Browse files Browse the repository at this point in the history
  • Loading branch information
stevejalim committed Jan 24, 2024
1 parent b00c829 commit 9c1e81d
Showing 1 changed file with 11 additions and 4 deletions.
15 changes: 11 additions & 4 deletions csp/tests/test_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ def literal(s):
return s


lazy_literal = lazy(literal)
lazy_literal = lazy(literal, str)


@override_settings(CSP_DEFAULT_SRC=["example.com", "example2.com"])
Expand Down Expand Up @@ -247,11 +247,14 @@ def test_require_trusted_types_for():
policy_eq("default-src 'self'; require-trusted-types-for 'script'", policy)


@override_settings(CSP_TRUSTED_TYPES=["strictPolicy", "laxPolicy", "default", "'allow-duplicates'"])
@override_settings(
CSP_TRUSTED_TYPES=["strictPolicy", "laxPolicy", "default", "'allow-duplicates'"]
)
def test_trusted_types():
policy = build_policy()
policy_eq(
"default-src 'self'; trusted-types strictPolicy laxPolicy " + "default 'allow-duplicates'",
"default-src 'self'; trusted-types strictPolicy laxPolicy "
+ "default 'allow-duplicates'",
policy,
)

Expand All @@ -277,7 +280,11 @@ def test_nonce():
def test_nonce_include_in():
policy = build_policy(nonce="abc123")
policy_eq(
("default-src 'self'; " "script-src 'nonce-abc123'; " "style-src 'nonce-abc123'"),
(
"default-src 'self'; "
"script-src 'nonce-abc123'; "
"style-src 'nonce-abc123'"
),
policy,
)

Expand Down

0 comments on commit 9c1e81d

Please sign in to comment.