Commit ddfda4db authored by Juliana Rodrigues's avatar Juliana Rodrigues Committed by Juliana Oliveira Rodrigues

comparators.xml: fixes test_android_manifest from test_apk

This patch fixes test_android_manifest to use new XMLFile
structure.
Signed-off-by: default avatarJuliana Rodrigues <juliana.orod@gmail.com>
parent 1e401a73
......@@ -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):
......
......@@ -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):
......
@@ -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"/>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment