MCPcopy
hub / github.com/django/django / test_config_value_as_set

Method test_config_value_as_set

tests/utils_tests/test_csp.py:66–77  ·  view source on GitHub ↗

Test that a set can be passed as a value. Sets are often used in Django settings to ensure uniqueness, however, sets are unordered. The middleware ensures consistency via sorting if a set is passed.

(self)

Source from the content-addressed store, hash-verified

64 self.assertPolicyEqual(build_policy(policy), "default-src 'self' foo.com")
65
66 def test_config_value_as_set(self):
67 """
68 Test that a set can be passed as a value.
69
70 Sets are often used in Django settings to ensure uniqueness, however,
71 sets are unordered. The middleware ensures consistency via sorting if a
72 set is passed.
73 """
74 policy = {"default-src": {CSP.SELF, "foo.com", "bar.com"}}
75 self.assertPolicyEqual(
76 build_policy(policy), "default-src 'self' bar.com foo.com"
77 )
78
79 def test_config_value_none(self):
80 """

Callers

nothing calls this directly

Calls 2

assertPolicyEqualMethod · 0.95
build_policyFunction · 0.90

Tested by

no test coverage detected