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 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
112 | 112 |
113 def test_full_content_types_map(): | 113 def test_full_content_types_map(): |
114 filenames = ['no-extension', packagerEdge.MANIFEST, packagerEdge.BLOCKMAP] | 114 filenames = ['no-extension', packagerEdge.MANIFEST, packagerEdge.BLOCKMAP] |
115 filenames += ['file.' + x for x in 'json html js png css git otf'.split()] | 115 filenames += ['file.' + x for x in 'json html js png css git otf'.split()] |
116 ctm_dict = ctm2dict(packagerEdge.create_content_types_map(filenames)) | 116 ctm_dict = ctm2dict(packagerEdge.create_content_types_map(filenames)) |
117 assert ctm_dict['defaults'] == { | 117 assert ctm_dict['defaults'] == { |
118 'css': 'text/css', | 118 'css': 'text/css', |
119 'html': 'text/html', | 119 'html': 'text/html', |
120 'js': 'application/javascript', | 120 'js': 'application/javascript', |
121 'json': 'application/json', | 121 'json': 'application/json', |
122 'otf': 'application/x-font-otf', | 122 'otf': 'application/octet-stream', |
123 'png': 'image/png', | 123 'png': 'image/png', |
124 'xml': 'application/xml' | 124 'xml': 'application/xml' |
125 } | 125 } |
126 assert ctm_dict['overrides'] == { | 126 assert ctm_dict['overrides'] == { |
127 '/AppxBlockMap.xml': 'application/vnd.ms-appx.blockmap+xml', | 127 '/AppxBlockMap.xml': 'application/vnd.ms-appx.blockmap+xml', |
128 '/AppxManifest.xml': 'application/vnd.ms-appx.manifest+xml' | 128 '/AppxManifest.xml': 'application/vnd.ms-appx.manifest+xml' |
129 } | 129 } |
130 | 130 |
131 | 131 |
132 def test_create_appx_manifest(metadata, files): | 132 def test_create_appx_manifest(metadata, files): |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
171 assert 'devbuild-marker' not in appx.read('AppxManifest.xml') | 171 assert 'devbuild-marker' not in appx.read('AppxManifest.xml') |
172 assert appx.read('Assets/logo_44.png') == '44' | 172 assert appx.read('Assets/logo_44.png') == '44' |
173 assert appx.read('Extension/icons/abp-44.png') == '44' | 173 assert appx.read('Extension/icons/abp-44.png') == '44' |
174 | 174 |
175 | 175 |
176 def test_create_devbuild(tmpdir, srcdir): | 176 def test_create_devbuild(tmpdir, srcdir): |
177 out_file = str(tmpdir.join('abp.appx')) | 177 out_file = str(tmpdir.join('abp.appx')) |
178 packagerEdge.createBuild(str(srcdir), outFile=out_file, releaseBuild=False) | 178 packagerEdge.createBuild(str(srcdir), outFile=out_file, releaseBuild=False) |
179 appx = zipfile.ZipFile(out_file) | 179 appx = zipfile.ZipFile(out_file) |
180 assert 'devbuild-marker' in appx.read('AppxManifest.xml') | 180 assert 'devbuild-marker' in appx.read('AppxManifest.xml') |
OLD | NEW |