| OLD | NEW |
| 1 # This Source Code Form is subject to the terms of the Mozilla Public | 1 # This Source Code Form is subject to the terms of the Mozilla Public |
| 2 # License, v. 2.0. If a copy of the MPL was not distributed with this | 2 # License, v. 2.0. If a copy of the MPL was not distributed with this |
| 3 # file, You can obtain one at http://mozilla.org/MPL/2.0/. | 3 # file, You can obtain one at http://mozilla.org/MPL/2.0/. |
| 4 | 4 |
| 5 import ConfigParser | 5 import ConfigParser |
| 6 import json | 6 import json |
| 7 import os | 7 import os |
| 8 import shutil | 8 import shutil |
| 9 import xml.etree.ElementTree as ET | 9 import xml.etree.ElementTree as ET |
| 10 import zipfile | 10 import zipfile |
| (...skipping 195 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 206 [first, attr('Id')], | 206 [first, attr('Id')], |
| 207 '1.0'), | 207 '1.0'), |
| 208 ('./ns:Applications/ns:Application/ns:Extensions/uap3:Extension/' | 208 ('./ns:Applications/ns:Application/ns:Extensions/uap3:Extension/' |
| 209 'uap3:AppExtension', | 209 'uap3:AppExtension', |
| 210 [first, attr('DisplayName')], | 210 [first, attr('DisplayName')], |
| 211 'Adblock Plus'), | 211 'Adblock Plus'), |
| 212 ] | 212 ] |
| 213 | 213 |
| 214 for release_build, pairs in [(False, devbuild), (True, release)]: | 214 for release_build, pairs in [(False, devbuild), (True, release)]: |
| 215 manifest = ET.fromstring(packagerEdge.create_appx_manifest( | 215 manifest = ET.fromstring(packagerEdge.create_appx_manifest( |
| 216 {'metadata': metadata}, | 216 {'metadata': metadata, 'version': '1.2.3.4'}, |
| 217 files, | 217 files, |
| 218 release_build=release_build)) | 218 release_build=release_build)) |
| 219 for expression, modifiers, value in pairs: | 219 for expression, modifiers, value in pairs: |
| 220 res = reduce( | 220 res = reduce( |
| 221 lambda val, func: func(val), | 221 lambda val, func: func(val), |
| 222 modifiers, | 222 modifiers, |
| 223 manifest.findall(expression, namespaces=namespaces)) | 223 manifest.findall(expression, namespaces=namespaces)) |
| 224 assert res == value | 224 assert res == value |
| 225 | 225 |
| 226 | 226 |
| (...skipping 23 matching lines...) Expand all Loading... |
| 250 assert 'devbuild-marker' not in appx.read('AppxManifest.xml') | 250 assert 'devbuild-marker' not in appx.read('AppxManifest.xml') |
| 251 assert appx.read('Assets/logo_44.png') == '44' | 251 assert appx.read('Assets/logo_44.png') == '44' |
| 252 assert appx.read('Extension/icons/abp-44.png') == '44' | 252 assert appx.read('Extension/icons/abp-44.png') == '44' |
| 253 | 253 |
| 254 | 254 |
| 255 def test_create_devbuild(tmpdir, srcdir): | 255 def test_create_devbuild(tmpdir, srcdir): |
| 256 out_file = str(tmpdir.join('abp.appx')) | 256 out_file = str(tmpdir.join('abp.appx')) |
| 257 packagerEdge.createBuild(str(srcdir), outFile=out_file, releaseBuild=False) | 257 packagerEdge.createBuild(str(srcdir), outFile=out_file, releaseBuild=False) |
| 258 appx = zipfile.ZipFile(out_file) | 258 appx = zipfile.ZipFile(out_file) |
| 259 assert 'devbuild-marker' in appx.read('AppxManifest.xml') | 259 assert 'devbuild-marker' in appx.read('AppxManifest.xml') |
| OLD | NEW |