コード例 #1
0
ファイル: test_directive.py プロジェクト: tlauinger/csp-utils
 def testDirective_asBasicDirectives_single(self):
     assert Directive.INVALID().asBasicDirectives() == set([])
     assert Directive.EVAL_SCRIPT_BASE_RESTRICTION().asBasicDirectives() == set([])
     assert Directive.INLINE_SCRIPT_BASE_RESTRICTION().asBasicDirectives() == set([])
     assert Directive.INLINE_STYLE_BASE_RESTRICTION().asBasicDirectives() == set([])
     sampleDirective = Directive("img-src", [DirectiveTest.sampleSrcExpr1b])
     assert sampleDirective.asBasicDirectives() == set([sampleDirective])
コード例 #2
0
ファイル: test_directive.py プロジェクト: tlauinger/csp-utils
 def testDirective_asBasicDirectives_multiple(self):
     sampleDirective = Directive("script-src", [SelfSourceExpression.SELF(),
                                                DirectiveTest.sampleSrcExpr1a,
                                                DirectiveTest.sampleSrcExpr2,
                                                DirectiveTest.sampleSrcExpr3])
     assert sampleDirective.asBasicDirectives() == set([Directive("script-src", [SelfSourceExpression.SELF()]),
                                                        Directive("script-src", [DirectiveTest.sampleSrcExpr1a]),
                                                        Directive("script-src", [DirectiveTest.sampleSrcExpr2]),
                                                        Directive("script-src", [DirectiveTest.sampleSrcExpr3])])
コード例 #3
0
 def testDirective_asBasicDirectives_single(self):
     assert Directive.INVALID().asBasicDirectives() == set([])
     assert Directive.EVAL_SCRIPT_BASE_RESTRICTION().asBasicDirectives(
     ) == set([])
     assert Directive.INLINE_SCRIPT_BASE_RESTRICTION().asBasicDirectives(
     ) == set([])
     assert Directive.INLINE_STYLE_BASE_RESTRICTION().asBasicDirectives(
     ) == set([])
     sampleDirective = Directive("img-src", [DirectiveTest.sampleSrcExpr1b])
     assert sampleDirective.asBasicDirectives() == set([sampleDirective])
コード例 #4
0
 def testDirective_asBasicDirectives_multiple(self):
     sampleDirective = Directive("script-src", [
         SelfSourceExpression.SELF(), DirectiveTest.sampleSrcExpr1a,
         DirectiveTest.sampleSrcExpr2, DirectiveTest.sampleSrcExpr3
     ])
     assert sampleDirective.asBasicDirectives() == set([
         Directive("script-src", [SelfSourceExpression.SELF()]),
         Directive("script-src", [DirectiveTest.sampleSrcExpr1a]),
         Directive("script-src", [DirectiveTest.sampleSrcExpr2]),
         Directive("script-src", [DirectiveTest.sampleSrcExpr3])
     ])