def test_parse_uri_scheme(self):
     exprStr = "chrome-extension:"
     srcExpr = SourceExpressionParser().parse(exprStr)
     assert srcExpr == URISourceExpression("chrome-extension", None, None, None)
     assert srcExpr.getType() == "uri"
     assert srcExpr.getScheme() == "chrome-extension"
     assert srcExpr.getHost() == None
     assert srcExpr.getPort() == None
     assert srcExpr.getPath() == None
     assert str(srcExpr) == exprStr
Example #2
0
 def test_parse_uri_full(self):
     exprStr = "http://seclab.nu:80/path"
     srcExpr = SourceExpressionParser().parse(exprStr)
     assert srcExpr == URISourceExpression("http", "seclab.nu", 80, "/path")
     assert srcExpr.getType() == "uri"
     assert srcExpr.getScheme() == "http"
     assert srcExpr.getHost() == "seclab.nu"
     assert srcExpr.getPort() == 80
     assert srcExpr.getPath() == "/path"
     assert str(srcExpr) == exprStr
 def test_parse_uri_full(self):
     exprStr = "http://seclab.nu:80/path"
     srcExpr = SourceExpressionParser().parse(exprStr)
     assert srcExpr == URISourceExpression("http", "seclab.nu", 80, "/path")
     assert srcExpr.getType() == "uri"
     assert srcExpr.getScheme() == "http"
     assert srcExpr.getHost() == "seclab.nu"
     assert srcExpr.getPort() == 80
     assert srcExpr.getPath() == "/path"
     assert str(srcExpr) == exprStr
Example #4
0
 def test_parse_uri_scheme(self):
     exprStr = "chrome-extension:"
     srcExpr = SourceExpressionParser().parse(exprStr)
     assert srcExpr == URISourceExpression("chrome-extension", None, None,
                                           None)
     assert srcExpr.getType() == "uri"
     assert srcExpr.getScheme() == "chrome-extension"
     assert srcExpr.getHost() == None
     assert srcExpr.getPort() == None
     assert srcExpr.getPath() == None
     assert str(srcExpr) == exprStr
 def test_parse_self(self):
     srcExpr = SourceExpressionParser().parse("'self'")
     assert srcExpr == SelfSourceExpression.SELF()
     assert srcExpr.getType() == "self"
     assert srcExpr == SourceExpressionParser().parse("'SELF'")
 def test_parse_inline(self):
     srcExpr = SourceExpressionParser().parse("'unsafe-inline'")
     assert srcExpr == SourceExpression.UNSAFE_INLINE()
     assert srcExpr.getType() == "unsafe-inline"
     assert srcExpr == SourceExpressionParser().parse("'UNSAFE-INLINE'")
 def test_parse_eval(self):
     srcExpr = SourceExpressionParser().parse("'unsafe-eval'")
     assert srcExpr == SourceExpression.UNSAFE_EVAL()
     assert srcExpr.getType() == "unsafe-eval"
     assert srcExpr == SourceExpressionParser().parse("'UNSAFE-EVAL'")
Example #8
0
 def test_parse_self(self):
     srcExpr = SourceExpressionParser().parse("'self'")
     assert srcExpr == SelfSourceExpression.SELF()
     assert srcExpr.getType() == "self"
     assert srcExpr == SourceExpressionParser().parse("'SELF'")
Example #9
0
 def test_parse_inline(self):
     srcExpr = SourceExpressionParser().parse("'unsafe-inline'")
     assert srcExpr == SourceExpression.UNSAFE_INLINE()
     assert srcExpr.getType() == "unsafe-inline"
     assert srcExpr == SourceExpressionParser().parse("'UNSAFE-INLINE'")
Example #10
0
 def test_parse_eval(self):
     srcExpr = SourceExpressionParser().parse("'unsafe-eval'")
     assert srcExpr == SourceExpression.UNSAFE_EVAL()
     assert srcExpr.getType() == "unsafe-eval"
     assert srcExpr == SourceExpressionParser().parse("'UNSAFE-EVAL'")