def testPolicy_compareTo_regular(self): pol1 = Policy([PolicyTest.sampleDirective7, PolicyTest.sampleDirective8]) pol2 = Policy([PolicyTest.sampleDirective7, PolicyTest.sampleDirective9]) assert pol1.compareTo(pol2) == (set([Policy([PolicyTest.sampleDirective7])]), set([Policy([PolicyTest.sampleDirective8])]), set([Policy([PolicyTest.sampleDirective9])])) assert pol2.compareTo(pol1) == (set([Policy([PolicyTest.sampleDirective7])]), set([Policy([PolicyTest.sampleDirective9])]), set([Policy([PolicyTest.sampleDirective8])])) assert pol1.compareTo(pol1) == (set([Policy([PolicyTest.sampleDirective7]), Policy([PolicyTest.sampleDirective8])]), set([]), set([]))
def testPolicy_compareTo_invalid(self): assert Policy.INVALID().compareTo(Policy.INVALID()) == (set([]), set([]), set([])) pol = Policy([PolicyTest.sampleDirective9]) assert pol.compareTo(Policy.INVALID()) == (set([]), set([]), set([])) assert Policy.INVALID().compareTo(pol) == (set([]), set([]), set([]))
def testPolicy_compareTo_regular(self): pol1 = Policy( [PolicyTest.sampleDirective7, PolicyTest.sampleDirective8]) pol2 = Policy( [PolicyTest.sampleDirective7, PolicyTest.sampleDirective9]) assert pol1.compareTo(pol2) == (set([ Policy([PolicyTest.sampleDirective7]) ]), set([Policy([PolicyTest.sampleDirective8]) ]), set([Policy([PolicyTest.sampleDirective9])])) assert pol2.compareTo(pol1) == (set([ Policy([PolicyTest.sampleDirective7]) ]), set([Policy([PolicyTest.sampleDirective9]) ]), set([Policy([PolicyTest.sampleDirective8])])) assert pol1.compareTo(pol1) == (set([ Policy([PolicyTest.sampleDirective7]), Policy([PolicyTest.sampleDirective8]) ]), set([]), set([]))
def testPolicy_compareTo_recursive(self): pol1 = Policy([PolicyTest.sampleDirective6]) pol2 = Policy( [Directive("style-src", [SourceExpression.UNSAFE_INLINE()])]) assert pol1.compareTo(pol2) == ( set([pol2]), set([ Policy([Directive("style-src", [SelfSourceExpression.SELF()])]) ]), set([]))
def testPolicy_compareTo_recursive(self): pol1 = Policy([PolicyTest.sampleDirective6]) pol2 = Policy([Directive("style-src", [SourceExpression.UNSAFE_INLINE()])]) assert pol1.compareTo(pol2) == (set([pol2]), set([Policy([Directive("style-src", [SelfSourceExpression.SELF()])])]), set([]))