diff options
| author | dm <dm@work-pc> | 2022-02-16 12:06:25 +0800 |
|---|---|---|
| committer | Árni Dagur <arni@dagur.eu> | 2022-02-26 22:06:53 +0100 |
| commit | 86ba5b7a5f65b6579813b86a4414270f896e6424 (patch) | |
| tree | af72d518a9be2a57f58e78d57c4ee22fd369ea90 /tests/test_exceptions.py | |
| parent | c63e6534d9d00121e773688e2ccd897c93dbdc69 (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.py | 13 |
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 @@ | |||
| 1 | import adblock | 1 | import adblock |
| 2 | 2 | import pytest | |
| 3 | 3 | ||
| 4 | def test_correct_baseclasses(): | 4 | def 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 | |||
| 15 | def 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) | ||
