Index: tests/test_packagerEdge.py |
diff --git a/tests/test_packagerEdge.py b/tests/test_packagerEdge.py |
index 03f4c2b07d67a29887bfcdeeebd90195df0bab3d..5b7bc1b8fb83e41bdd2a3370c717425e5b164e16 100644 |
--- a/tests/test_packagerEdge.py |
+++ b/tests/test_packagerEdge.py |
@@ -7,6 +7,7 @@ import json |
import os |
import shutil |
import xml.etree.ElementTree as ET |
+from lxml import etree |
import zipfile |
import pytest |
@@ -130,19 +131,67 @@ def test_full_content_types_map(): |
def test_create_appx_manifest(metadata, files): |
- manifest = packagerEdge.create_appx_manifest( |
- {'metadata': metadata}, files, release_build=True, |
- ) |
- with open(os.path.join(TEST_DIR, 'AppManifest.xml.expect')) as fp: |
- manifest_expect = fp.read() |
- assert manifest.strip() == manifest_expect.strip() |
- |
- |
-def test_create_devbuild_appx_manifest(metadata, files): |
- manifest = packagerEdge.create_appx_manifest( |
- {'metadata': metadata}, files, release_build=False, |
- ) |
- assert 'devbuild-marker' in manifest |
+ namespaces = { |
+ 'ns': 'http://schemas.microsoft.com/' |
+ 'appx/manifest/foundation/windows10', |
+ 'uap': 'http://schemas.microsoft.com/appx/manifest/uap/windows10', |
+ 'uap3': 'http://schemas.microsoft.com/appx/manifest/uap/windows10/3', |
+ } |
+ |
+ base = { |
+ 'count(//*)': 22.0, |
+ 'string(/ns:Package/ns:Identity/@Name)': 'EyeoGmbH.AdblockPlus', |
+ 'string(/ns:Package/ns:Identity/@Publisher)': |
+ 'CN=4F066043-8AFE-41C9-B762-6C15E77E3F88', |
+ 'string(/ns:Package/ns:Identity/@Version)': '1.2.3.0', |
+ 'string(/ns:Package/ns:Properties/ns:PublisherDisplayName)': |
+ 'Eyeo GmbH', |
+ 'string(/ns:Package/ns:Properties/ns:Logo)': 'Assets\\logo_50.png', |
+ ('string(/ns:Package/ns:Dependencies/ns:TargetDeviceFamily/' |
+ '@MinVersion)'): '10.0.14332.0', |
+ ('string(/ns:Package/ns:Dependencies/ns:TargetDeviceFamily/' |
+ '@MaxVersionTested)'): '12.0.0.0', |
+ ('string(/ns:Package/ns:Applications/ns:Application/' |
+ 'uap:VisualElements/@Square150x150Logo)'): 'Assets\\logo_150.png', |
+ ('string(/ns:Package/ns:Applications/ns:Application/' |
+ 'uap:VisualElements/@Square44x44Logo)'): 'Assets\\logo_44.png', |
+ ('string(/ns:Package/ns:Applications/ns:Application/' |
+ 'uap:VisualElements/@Description)'): |
+ 'Adblock Plus is the most popular ad blocker ever, and also ' |
+ 'supports websites by not blocking unobstrusive ads by ' |
+ 'default (configurable).', |
+ ('string(/ns:Package/ns:Applications/ns:Application/' |
+ 'uap:VisualElements/@BackgroundColor)'): 'red', |
+ } |
+ |
+ devbuild = base.copy() |
+ devbuild.update({ |
+ 'string(/ns:Package/ns:Properties/ns:DisplayName)': 'devbuild-marker', |
+ 'string(/ns:Package/ns:Applications/ns:Application/' |
+ 'uap:VisualElements/@DisplayName)': 'devbuild-marker', |
+ ('string(/ns:Package/ns:Applications/ns:Application/ns:Extensions/' |
+ 'uap3:Extension/uap3:AppExtension/@Id)'): 'EdgeExtension', |
+ 'string(/ns:Package/ns:Applications/' |
+ 'ns:Application/ns:Extensions/uap3:Extension/' |
+ 'uap3:AppExtension/@DisplayName)': 'devbuild-marker', |
+ }) |
+ |
+ release = base.copy() |
+ release.update({ |
+ 'string(/ns:Package/ns:Properties/ns:DisplayName)': 'Adblock Plus', |
+ ('string(/ns:Package/ns:Applications/ns:Application/' |
+ 'uap:VisualElements/@DisplayName)'): 'Adblock Plus', |
+ ('string(/ns:Package/ns:Applications/ns:Application/ns:Extensions/' |
+ 'uap3:Extension/uap3:AppExtension/@Id)'): '1.0', |
+ ('string(/ns:Package/ns:Applications/ns:Application/ns:Extensions/' |
+ 'uap3:Extension/uap3:AppExtension/@DisplayName)'): 'Adblock Plus', |
+ }) |
+ |
+ for release_build, pairs in [[False, devbuild], [True, release]]: |
Sebastian Noack
2016/12/21 15:54:15
Please use tuples for data that have structure (as
wspee
2017/01/02 14:16:19
Done.
|
+ manifest = etree.fromstring(packagerEdge.create_appx_manifest( |
+ {'metadata': metadata}, files, release_build=release_build)) |
+ for expression, value in pairs.items(): |
+ assert manifest.xpath(expression, namespaces=namespaces) == value |
def test_move_files_to_extension(): |