summaryrefslogtreecommitdiff
path: root/tests/test_exceptions.py
diff options
context:
space:
mode:
authordm <dm@work-pc>2022-02-16 12:06:25 +0800
committerÁrni Dagur <arni@dagur.eu>2022-02-26 22:06:53 +0100
commit86ba5b7a5f65b6579813b86a4414270f896e6424 (patch)
treeaf72d518a9be2a57f58e78d57c4ee22fd369ea90 /tests/test_exceptions.py
parentc63e6534d9d00121e773688e2ccd897c93dbdc69 (diff)
feat: include complete redirect rule feature.
1. update adblock-rust => 0.4.3 2. add `include_redirect_urls` parameter for `FilterSet.add_filter_list` and `FilterSet.add_filters` 3. add `Engine.add_resource` method. 4. add `adblock.AddResourceError` Exception 5. add `redirect_type` for `BlockerResult` 6. add some tests for these functions.
Diffstat (limited to 'tests/test_exceptions.py')
-rw-r--r--tests/test_exceptions.py13
1 files changed, 12 insertions, 1 deletions
diff --git a/tests/test_exceptions.py b/tests/test_exceptions.py
index becf107..3e3dc9f 100644
--- a/tests/test_exceptions.py
+++ b/tests/test_exceptions.py
@@ -1,5 +1,5 @@
1import adblock 1import adblock
2 2import pytest
3 3
4def test_correct_baseclasses(): 4def test_correct_baseclasses():
5 assert issubclass(adblock.AdblockException, Exception) 5 assert issubclass(adblock.AdblockException, Exception)
@@ -9,3 +9,14 @@ def test_correct_baseclasses():
9 assert issubclass(adblock.OptimizedFilterExistence, adblock.BlockerException) 9 assert issubclass(adblock.OptimizedFilterExistence, adblock.BlockerException)
10 assert issubclass(adblock.BadFilterAddUnsupported, adblock.BlockerException) 10 assert issubclass(adblock.BadFilterAddUnsupported, adblock.BlockerException)
11 assert issubclass(adblock.FilterExists, adblock.BlockerException) 11 assert issubclass(adblock.FilterExists, adblock.BlockerException)
12 assert issubclass(adblock.AddResourceError, adblock.BlockerException)
13
14
15def test_add_resource_error():
16 filter_set = adblock.FilterSet()
17 engine = adblock.Engine(filter_set=filter_set)
18
19 with pytest.raises(adblock.AddResourceError) as exc:
20 engine.add_resource(name='aa', content_type="image/jpeg", content="111")
21
22 assert "invalid base64 content" in str(exc.value)