OLD | NEW |
1 # This file is part of Adblock Plus <https://adblockplus.org/>, | 1 # This file is part of Adblock Plus <https://adblockplus.org/>, |
2 # Copyright (C) 2006-present eyeo GmbH | 2 # Copyright (C) 2006-present eyeo GmbH |
3 # | 3 # |
4 # Adblock Plus is free software: you can redistribute it and/or modify | 4 # Adblock Plus is free software: you can redistribute it and/or modify |
5 # it under the terms of the GNU General Public License version 3 as | 5 # it under the terms of the GNU General Public License version 3 as |
6 # published by the Free Software Foundation. | 6 # published by the Free Software Foundation. |
7 # | 7 # |
8 # Adblock Plus is distributed in the hope that it will be useful, | 8 # Adblock Plus is distributed in the hope that it will be useful, |
9 # but WITHOUT ANY WARRANTY; without even the implied warranty of | 9 # but WITHOUT ANY WARRANTY; without even the implied warranty of |
10 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 10 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
11 # GNU General Public License for more details. | 11 # GNU General Public License for more details. |
12 # | 12 # |
13 # You should have received a copy of the GNU General Public License | 13 # You should have received a copy of the GNU General Public License |
14 # along with Adblock Plus. If not, see <http://www.gnu.org/licenses/>. | 14 # along with Adblock Plus. If not, see <http://www.gnu.org/licenses/>. |
15 | 15 |
16 | 16 |
17 from abp.filters.renderer import render_diff | 17 from abp.filters.renderer import render_diff |
18 | 18 |
19 BASE = '''[Adblock Plus 2.0] | 19 BASE = '''[Adblock Plus 2.0] |
20 ! Version: 111 | 20 ! Version: 111 |
21 ! diff-url: https://easylist-downloads.adblockplus.org/easylist/diffs/111.txt | 21 ! diff-url: https://easylist-downloads.adblockplus.org/easylist/diffs/111.txt |
22 ! diff-expires: 1 hours | 22 ! diff-expires: 1 hours |
23 ! Title: EasyList | 23 ! Title: EasyList |
24 ! Last modified: 26 Jul 2018 02:10 UTC | |
25 ! Expires: 1 days (update frequency) | 24 ! Expires: 1 days (update frequency) |
26 ! Homepage: https://easylist.to/ | 25 ! Homepage: https://easylist.to/ |
27 ! Licence: https://easylist.to/pages/licence.html | 26 ! Licence: https://easylist.to/pages/licence.html |
28 ! | 27 ! |
29 ! Please report any unblocked adverts or problems | 28 ! Please report any unblocked adverts or problems |
30 ! in the forums (https://forums.lanik.us/) | 29 ! in the forums (https://forums.lanik.us/) |
31 ! or via e-mail (easylist.subscription@gmail.com). | 30 ! or via e-mail (easylist.subscription@gmail.com). |
32 ! | 31 ! |
33 !-----------------------General advert blocking filters-----------------------! | 32 !-----------------------General advert blocking filters-----------------------! |
34 ! *** easylist:easylist/easylist_general_block.txt *** | 33 ! *** easylist:easylist/easylist_general_block.txt *** |
35 test | 34 test |
36 &act=ads_ | 35 &act=ads_ |
37 &ad.vid=$~xmlhttprequest | 36 &ad.vid=$~xmlhttprequest |
38 &ad_box_ | 37 &ad_box_ |
39 ''' | 38 ''' |
40 | 39 |
41 LATEST = '''[Adblock Plus 2.0] | 40 LATEST = '''[Adblock Plus 2.0] |
42 ! Version: 123 | 41 ! Version: 123 |
43 ! Diff-URL: https://easylist-downloads.adblockplus.org/easylist/diffs/123.txt | 42 ! Diff-URL: https://easylist-downloads.adblockplus.org/easylist/diffs/123.txt |
44 ! Diff-Expires: 1 hours | 43 ! Diff-Expires: 1 hours |
45 ! Title: EasyList | 44 ! Title: EasyList |
46 ! Last modified: 26 Jul 2018 21:00 UTC | |
47 ! Homepage: https://easylist.to/ | 45 ! Homepage: https://easylist.to/ |
48 ! Licence: https://easylist.to/pages/licence.html | 46 ! Licence: https://easylist.to/pages/licence.html |
49 ! | 47 ! |
50 ! Please report any unblocked adverts or problems | 48 ! Please report any unblocked adverts or problems |
51 ! in the forums (https://forums.lanik.us/) | 49 ! in the forums (https://forums.lanik.us/) |
52 ! or via e-mail (easylist.subscription@gmail.com). | 50 ! or via e-mail (easylist.subscription@gmail.com). |
53 ! | 51 ! |
54 !-----------------------General advert blocking filters-----------------------! | 52 !-----------------------General advert blocking filters-----------------------! |
55 ! *** easylist:easylist/easylist_general_block.txt *** | 53 ! *** easylist:easylist/easylist_general_block.txt *** |
56 &act=ads_ | 54 &act=ads_ |
57 &ad_box_ | 55 &ad_box_ |
58 &ad_channel= | 56 &ad_channel= |
59 test | 57 test |
60 ''' | 58 ''' |
61 | 59 |
62 | 60 |
63 EXPECTED = '''[Adblock Plus Diff] | 61 EXPECTED = '''[Adblock Plus Diff] |
64 ! Diff-URL: https://easylist-downloads.adblockplus.org/easylist/diffs/123.txt | 62 ! Diff-URL: https://easylist-downloads.adblockplus.org/easylist/diffs/123.txt |
65 ! Expires: | 63 ! Expires: |
66 ! Version: 123 | 64 ! Version: 123 |
67 - &ad.vid=$~xmlhttprequest | 65 - &ad.vid=$~xmlhttprequest |
68 + &ad_channel= | 66 + &ad_channel= |
69 ''' | 67 ''' |
70 | 68 |
71 | 69 |
72 def test_differ(): | 70 def test_differ(): |
73 exp = set(EXPECTED.splitlines()) | 71 exp = set(EXPECTED.splitlines()) |
74 gen = set(render_diff(BASE.splitlines(), LATEST.splitlines())) | 72 gen = set(render_diff(BASE.splitlines(), LATEST.splitlines())) |
75 assert(gen == exp) | 73 assert(gen == exp) |
OLD | NEW |