def test_default(self): request = pretend.stub( registry=pretend.stub( settings={} ) ) result = csp.csp_factory(None, request) assert isinstance(result, csp.CSPPolicy) assert result == {}
def test_copy(self): settings = {"csp": {"foo": "bar"}} request = pretend.stub(registry=pretend.stub(settings=settings)) result = csp.csp_factory(None, request) assert isinstance(result, csp.CSPPolicy) assert result == settings["csp"] # ensure changes to factory result don't propagate back to the # settings result["baz"] = "foo" assert result == {"foo": "bar", "baz": "foo"} assert settings == {"csp": {"foo": "bar"}}