Ejemplo n.º 1
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
Ejemplo n.º 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
Ejemplo n.º 3
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
Ejemplo n.º 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
Ejemplo n.º 5
0
 def test_parse_self(self):
     srcExpr = SourceExpressionParser().parse("'self'")
     assert srcExpr == SelfSourceExpression.SELF()
     assert srcExpr.getType() == "self"
     assert srcExpr == SourceExpressionParser().parse("'SELF'")
Ejemplo n.º 6
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'")
Ejemplo n.º 7
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'")
Ejemplo n.º 8
0
 def test_parse_self(self):
     srcExpr = SourceExpressionParser().parse("'self'")
     assert srcExpr == SelfSourceExpression.SELF()
     assert srcExpr.getType() == "self"
     assert srcExpr == SourceExpressionParser().parse("'SELF'")
Ejemplo n.º 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'")
Ejemplo n.º 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'")