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

Unified Diff: sitescripts/extensions/test/test_updateManifests.py

Issue 29366797: Issue 4697 - Add support for WebExtension-based Firefox development builds (Closed) Base URL: https://hg.adblockplus.org/sitescripts
Patch Set: Updated tests and update manifest generation Created Dec. 5, 2016, 11:21 a.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
« no previous file with comments | « sitescripts/extensions/test/sitescripts.ini.template ('k') | sitescripts/extensions/utils.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sitescripts/extensions/test/test_updateManifests.py
===================================================================
--- a/sitescripts/extensions/test/test_updateManifests.py
+++ b/sitescripts/extensions/test/test_updateManifests.py
@@ -14,48 +14,31 @@
# along with Adblock Plus. If not, see <http://www.gnu.org/licenses/>.
"""Tests for update manifest generation script."""
import os
import json
import pytest
import subprocess
-import xml.etree.ElementTree as ET
-
-
-def rdf2data(rdf):
- """Convert RDF to a more comparable data strcuture."""
- # We need this to address the RDF item ordering discrepancies.
- def et2data(node):
- return {
- 'tag': node.tag,
- 'text': node.text,
- 'attrib': node.attrib,
- 'subs': sorted(et2data(sub) for sub in node)
- }
- return et2data(ET.fromstring(rdf))
@pytest.fixture(scope='session')
def oracle(tests_dir):
"""Function that returns expected content of generated files."""
def expected_value_of(what):
return tests_dir.join('oracle').join(what).read().strip()
return expected_value_of
def test_update_manifests(config_ini, hg_dir, tmpdir, oracle):
env = dict(os.environ)
env['SITESCRIPTS_CONFIG'] = str(config_ini)
cmd = ['python', '-m', 'sitescripts.extensions.bin.updateUpdateManifests']
subprocess.check_call(cmd, env=env)
for filename in ['androidupdates.json', 'androidupdates.xml',
- 'ieupdate.json', 'update.rdf', 'updates.plist']:
+ 'ieupdate.json', 'updates.json', 'updates.plist']:
got = tmpdir.join(filename).read().strip()
expect = oracle(filename)
if filename.endswith('.json'):
got = json.loads(got)
expect = json.loads(expect)
- elif filename.endswith('.rdf'):
- got = rdf2data(got)
- expect = rdf2data(expect)
assert got == expect
« no previous file with comments | « sitescripts/extensions/test/sitescripts.ini.template ('k') | sitescripts/extensions/utils.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld