Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Unified Diff: tests/test_parser.py

Issue 29793573: Issue 6701 - Implement CSP support in python-abp (Closed) Base URL: https://hg.adblockplus.org/python-abp/
Patch Set: Check negation first, and added some tests Created June 7, 2018, 11:12 p.m.
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « abp/filters/parser.py ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tests/test_parser.py
===================================================================
--- a/tests/test_parser.py
+++ b/tests/test_parser.py
@@ -67,6 +67,47 @@
(OPT.SITEKEY, ['foo', 'bar']),
],
},
+ "||foo.com^$csp=script-src 'self' * 'unsafe-inline'": {
+ 'selector': {'type': ST.URL_PATTERN, 'value': '||foo.com^'},
+ 'action': FA.BLOCK,
+ 'options': [
+ (OPT.CSP, "script-src 'self' * 'unsafe-inline'"),
+ ],
+ },
+ 'bla$match-case,csp=first csp,script,other,domain=foo.com,sitekey=foo': {
Vasily Kuznetsov 2018/06/08 16:41:48 It seems like this test does more or less the sane
rhowell 2018/06/12 21:13:18 Done.
+ 'selector': {'type': ST.URL_PATTERN, 'value': 'bla'},
+ 'action': FA.BLOCK,
+ 'options': [
+ ('match-case', True),
+ ('csp', 'first csp'),
+ ('script', True),
+ ('other', True),
+ ('domain', [('foo.com', True)]),
+ ('sitekey', ['foo']),
+ ],
+ },
+ 'bla$~match-case,~csp=csp,~script,~other,~third-party,domain=~bar.com': {
+ 'selector': {'type': ST.URL_PATTERN, 'value': 'bla'},
+ 'action': FA.BLOCK,
+ 'options': [
+ ('match-case', False),
+ ('csp=csp', False),
Vasily Kuznetsov 2018/06/08 16:41:48 Hm, I think this should be ('csp', False). I guess
rhowell 2018/06/12 21:13:18 Done.
+ ('script', False),
+ ('other', False),
+ ('third-party', False),
+ ('domain', [('bar.com', False)]),
+ ],
+ },
+ '@@bla$script,other,domain=foo.com|~bar.foo.com,csp=c s p': {
Vasily Kuznetsov 2018/06/08 16:41:48 This one adds testing, of a CSP option in an excep
rhowell 2018/06/12 21:13:18 I already combined the first two csp tests, so now
+ 'selector': {'type': ST.URL_PATTERN, 'value': 'bla'},
+ 'action': FA.ALLOW,
+ 'options': [
+ ('script', True),
+ ('other', True),
+ ('domain', [('foo.com', True), ('bar.foo.com', False)]),
+ ('csp', 'c s p'),
+ ],
+ },
# Element hiding filters and exceptions.
'##ddd': {
'selector': {'type': ST.CSS, 'value': 'ddd'},
« no previous file with comments | « abp/filters/parser.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld