| Index: tests/test_differ.py | 
| =================================================================== | 
| new file mode 100644 | 
| --- /dev/null | 
| +++ b/tests/test_differ.py | 
| @@ -0,0 +1,81 @@ | 
| +# This file is part of Adblock Plus <https://adblockplus.org/>, | 
| +# Copyright (C) 2006-present eyeo GmbH | 
| +# | 
| +# Adblock Plus is free software: you can redistribute it and/or modify | 
| +# it under the terms of the GNU General Public License version 3 as | 
| +# published by the Free Software Foundation. | 
| +# | 
| +# Adblock Plus is distributed in the hope that it will be useful, | 
| +# but WITHOUT ANY WARRANTY; without even the implied warranty of | 
| +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the | 
| +# GNU General Public License for more details. | 
| +# | 
| +# You should have received a copy of the GNU General Public License | 
| +# along with Adblock Plus.  If not, see <http://www.gnu.org/licenses/>. | 
| + | 
| + | 
| +from abp.create_diff import generate_diff | 
| + | 
| + | 
| +BASE = '''[Adblock Plus 2.0] | 
| +! Checksum: O6rd2aavziYFTXVIGAMimg | 
| +! Version: 111 | 
| +! Diff-URL: https://easylist-downloads.adblockplus.org/easylist/diffs/111.txt | 
| +! Diff-Expires: 1 hours | 
| +! Title: EasyList | 
| +! Last modified: 26 Jul 2018 02:10 UTC | 
| +! Expires: 1 days (update frequency) | 
| +! Homepage: https://easylist.to/ | 
| +! Licence: https://easylist.to/pages/licence.html | 
| +! | 
| +! Please report any unblocked adverts or problems | 
| +! in the forums (https://forums.lanik.us/) | 
| +! or via e-mail (easylist.subscription@gmail.com). | 
| +! | 
| +!-----------------------General advert blocking filters-----------------------! | 
| +! *** easylist:easylist/easylist_general_block.txt *** | 
| +&act=ads_ | 
| +&ad.vid=$~xmlhttprequest | 
| +&ad_box_ | 
| +''' | 
| + | 
| +LATEST = '''[Adblock Plus 2.0] | 
| +! Checksum: H6T/6rjr+cjtpbghFTBTng | 
| +! Version: 123 | 
| +! Diff-URL: https://easylist-downloads.adblockplus.org/easylist/diffs/123.txt | 
| +! Diff-Expires: 1 hours | 
| +! Title: EasyList | 
| +! Last modified: 26 Jul 2018 21:00 UTC | 
| +! Expires: 1 days (update frequency) | 
| +! Homepage: https://easylist.to/ | 
| +! Licence: https://easylist.to/pages/licence.html | 
| +! | 
| +! Please report any unblocked adverts or problems | 
| +! in the forums (https://forums.lanik.us/) | 
| +! or via e-mail (easylist.subscription@gmail.com). | 
| +! | 
| +!-----------------------General advert blocking filters-----------------------! | 
| +! *** easylist:easylist/easylist_general_block.txt *** | 
| +&act=ads_ | 
| +&ad_box_ | 
| +&ad_channel= | 
| +''' | 
| + | 
| + | 
| +EXPECTED = '''[Adblock Plus Diff 2.0] | 
| +! Checksum: 1B2M2Y8AsgTpgAmY7PhCfg | 
| +! Version: 123 | 
| +! Diff-URL: https://easylist-downloads.adblockplus.org/easylist/diffs/123.txt | 
| +! Diff-Expires: 1 hours | 
| +! Title: EasyList | 
| +! Last modified: 26 Jul 2018 21:00 UTC | 
| +! Expires: 1 days (update frequency) | 
| +! Homepage: https://easylist.to/ | 
| +! Licence: https://easylist.to/pages/licence.html | 
| +- &ad.vid=$~xmlhttprequest | 
| ++ &ad_channel= | 
| +''' | 
| + | 
| + | 
| +def test_differ(): | 
| +    assert(generate_diff(BASE, LATEST) == EXPECTED) | 
|  |