Exemple #1
0
 def test_default(self):
     request = pretend.stub(
         registry=pretend.stub(
             settings={}
         )
     )
     result = csp.csp_factory(None, request)
     assert isinstance(result, csp.CSPPolicy)
     assert result == {}
Exemple #2
0
 def test_default(self):
     request = pretend.stub(
         registry=pretend.stub(
             settings={}
         )
     )
     result = csp.csp_factory(None, request)
     assert isinstance(result, csp.CSPPolicy)
     assert result == {}
Exemple #3
0
    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"}}
Exemple #4
0
    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"}}