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

Unified Diff: tests/test_differ.py

Issue 29845767: Issue 6685 - Offer incremental filter list downloads (Closed) Base URL: https://hg.adblockplus.org/python-abp/
Patch Set: Address comments on PS8 Created Aug. 30, 2018, 5:37 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
Index: tests/test_differ.py
===================================================================
new file mode 100644
--- /dev/null
+++ b/tests/test_differ.py
@@ -0,0 +1,75 @@
+# 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.filters.renderer import render_diff
+
+BASE = '''[Adblock Plus 2.0]
+! 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 ***
+test
+&act=ads_
+&ad.vid=$~xmlhttprequest
+&ad_box_
+'''
+
+LATEST = '''[Adblock Plus 2.0]
+! 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
+! 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=
+ test
+'''
+
+
+EXPECTED = '''[Adblock Plus Diff]
+! Diff-URL: https://easylist-downloads.adblockplus.org/easylist/diffs/123.txt
+! Expires:
+! Version: 123
+- &ad.vid=$~xmlhttprequest
++ &ad_channel=
+'''
+
+
+def test_differ():
+ exp = set(EXPECTED.splitlines())
+ gen = set(render_diff(BASE.splitlines(), LATEST.splitlines()))
+ assert(gen == exp)
« abp/filters/renderer.py ('K') | « abp/filters/renderer.py ('k') | tests/test_parser.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld