[diffoscope] 01/03: comparators.xml: fixes test_android_manifest from test_apk
Juliana Oliveira R
jwnx-guest at moszumanska.debian.org
Tue Jul 25 19:32:32 CEST 2017
This is an automated email from the git hooks/post-receive script.
jwnx-guest pushed a commit to branch master
in repository diffoscope.
commit ddfda4db36f5731f0c762cf4a96d6ce791f8b2bf
Author: Juliana Rodrigues <juliana.orod at gmail.com>
Date: Mon Jul 24 16:09:28 2017 -0300
comparators.xml: fixes test_android_manifest from test_apk
This patch fixes test_android_manifest to use new XMLFile
structure.
Signed-off-by: Juliana Rodrigues <juliana.orod at gmail.com>
---
diffoscope/comparators/xml.py | 2 +-
tests/comparators/test_apk.py | 9 +++++----
tests/data/apk_manifest_expected_diff | 18 +++++++++---------
3 files changed, 15 insertions(+), 14 deletions(-)
diff --git a/diffoscope/comparators/xml.py b/diffoscope/comparators/xml.py
index 2e657cc..1e94c10 100644
--- a/diffoscope/comparators/xml.py
+++ b/diffoscope/comparators/xml.py
@@ -60,7 +60,7 @@ def _parse(file):
_format(xml)
xml.normalize()
- return xml.toprettyxml(indent=2*' ')
+ return xml.toprettyxml(indent=2*' ', encoding='utf-8').decode('utf-8')
class XMLFile(File):
diff --git a/tests/comparators/test_apk.py b/tests/comparators/test_apk.py
index 0ff411a..3a9755e 100644
--- a/tests/comparators/test_apk.py
+++ b/tests/comparators/test_apk.py
@@ -20,10 +20,11 @@
import pytest
from diffoscope.comparators.apk import ApkFile
+from diffoscope.comparators.xml import XMLFile
-from ..utils.data import load_fixture, get_data
-from ..utils.tools import skip_unless_tools_exist
-from ..utils.nonexisting import assert_non_existing
+from tests.utils.data import load_fixture, get_data
+from tests.utils.tools import skip_unless_tools_exist
+from tests.utils.nonexisting import assert_non_existing
apk1 = load_fixture('test1.apk')
apk2 = load_fixture('test2.apk')
@@ -60,7 +61,7 @@ def test_android_manifest(differences):
assert differences[1].source1 == 'AndroidManifest.xml (decoded)'
assert differences[1].source2 == 'AndroidManifest.xml (decoded)'
expected_diff = get_data('apk_manifest_expected_diff')
- assert differences[1].unified_diff == expected_diff
+ assert differences[1].details[0].unified_diff == expected_diff
@skip_unless_tools_exist('apktool', 'zipinfo')
def test_apk_metadata_source(differences):
diff --git a/tests/data/apk_manifest_expected_diff b/tests/data/apk_manifest_expected_diff
index 9d37a92..89516db 100644
--- a/tests/data/apk_manifest_expected_diff
+++ b/tests/data/apk_manifest_expected_diff
@@ -1,11 +1,11 @@
@@ -1,9 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
--<manifest android:versionCode="1" android:versionName="1.0" package="com.any.any" platformBuildVersionCode="24" platformBuildVersionName="7.0.0"
-+<manifest android:versionCode="2" android:versionName="2.0" package="com.any.any" platformBuildVersionCode="24" platformBuildVersionName="7.0.0"
- xmlns:android="http://schemas.android.com/apk/res/android">
- <uses-permission android:name="android.permission.INTERNET" />
- <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
- <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
- <application>
- <activity android:name="com.any.any.SomeActivity">
- <intent-filter>
+-<manifest android:versionCode="1" android:versionName="1.0" package="com.any.any" platformBuildVersionCode="24" platformBuildVersionName="7.0.0" xmlns:android="http://schemas.android.com/apk/res/android">
++<manifest android:versionCode="2" android:versionName="2.0" package="com.any.any" platformBuildVersionCode="24" platformBuildVersionName="7.0.0" xmlns:android="http://schemas.android.com/apk/res/android">
+ <uses-permission android:name="android.permission.INTERNET"/>
+ <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION"/>
+ <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/>
+ <application>
+ <activity android:name="com.any.any.SomeActivity">
+ <intent-filter>
+ <action android:name="android.intent.action.MAIN"/>
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/reproducible/diffoscope.git
More information about the diffoscope
mailing list