Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Side by Side Diff: tests/test_packagerWebExt.py

Issue 29609559: Issue 6021 - Refactoring build.py (Closed) Base URL: https://hg.adblockplus.org/buildtools/file/79688f4a4aff
Patch Set: Addressing Wladimir's comments Created Nov. 17, 2017, 11:30 a.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View unified diff | Download patch
« build.py ('K') | « build.py ('k') | tox.ini » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 difflib 5 import difflib
6 import json 6 import json
7 import os 7 import os
8 import re 8 import re
9 import shutil 9 import shutil
10 import zipfile 10 import zipfile
11 from xml.etree import ElementTree 11 from xml.etree import ElementTree
12 from struct import unpack 12 from struct import unpack
13 13
14 import pytest 14 import pytest
15 from Crypto.Signature import PKCS1_v1_5 15 from Crypto.Signature import PKCS1_v1_5
16 from Crypto.PublicKey import RSA 16 from Crypto.PublicKey import RSA
17 from Crypto.Hash import SHA 17 from Crypto.Hash import SHA
18 18
19 from buildtools import packager 19 from buildtools import packager
20 from buildtools.packagerChrome import defaultLocale 20 from buildtools.packagerChrome import defaultLocale
21 from buildtools.build import processArgs 21 from buildtools.build import process_args
22 22
23 LOCALES_MODULE = { 23 LOCALES_MODULE = {
24 'test.Foobar': { 24 'test.Foobar': {
25 'message': 'Ensuring dict-copy from modules for $domain$', 25 'message': 'Ensuring dict-copy from modules for $domain$',
26 'description': 'test description', 26 'description': 'test description',
27 'placeholders': {'content': '$1', 'example': 'www.adblockplus.org'} 27 'placeholders': {'content': '$1', 'example': 'www.adblockplus.org'}
28 } 28 }
29 } 29 }
30 30
31 ALL_LANGUAGES = ['en_US', 'de', 'it'] 31 ALL_LANGUAGES = ['en_US', 'de', 'it']
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after
127 127
128 128
129 def run_webext_build(ext_type, build_opt, srcdir, keyfile=None): 129 def run_webext_build(ext_type, build_opt, srcdir, keyfile=None):
130 """Run a build process.""" 130 """Run a build process."""
131 cmd_mapping = { 131 cmd_mapping = {
132 'devenv': ['devenv'], 132 'devenv': ['devenv'],
133 'development_build': ['build', '-b', '1337'], 133 'development_build': ['build', '-b', '1337'],
134 'release_build': ['build', '-r'], 134 'release_build': ['build', '-r'],
135 } 135 }
136 136
137 args = ['build.py', '-t', ext_type] + cmd_mapping[build_opt] 137 args = cmd_mapping[build_opt] + ['-t', ext_type]
138 138
139 if keyfile: 139 if keyfile:
140 args += ['-k', keyfile] 140 args += ['-k', keyfile]
141 141
142 processArgs(str(srcdir), args) 142 process_args(str(srcdir), *args)
143 143
144 144
145 def locale_files(languages, rootfolder, srcdir): 145 def locale_files(languages, rootfolder, srcdir):
146 """Generate example locales. 146 """Generate example locales.
147 147
148 languages: tuple, list or set of languages to include 148 languages: tuple, list or set of languages to include
149 rootdir: folder-name to create the locale-folders in 149 rootdir: folder-name to create the locale-folders in
150 """ 150 """
151 for lang in languages: 151 for lang in languages:
152 subfolders = rootfolder.split(os.pathsep) + [lang, 'messages.json'] 152 subfolders = rootfolder.split(os.pathsep) + [lang, 'messages.json']
(...skipping 315 matching lines...) Expand 10 before | Expand all | Expand 10 after
468 expected = os.path.join( 468 expected = os.path.join(
469 os.path.dirname(__file__), 469 os.path.dirname(__file__),
470 'expecteddata', 470 'expecteddata',
471 filename.format(name, ext), 471 filename.format(name, ext),
472 ) 472 )
473 473
474 assert_manifest_content( 474 assert_manifest_content(
475 package.read(os.path.join(folder, '{}.{}'.format(name, ext))), 475 package.read(os.path.join(folder, '{}.{}'.format(name, ext))),
476 expected, 476 expected,
477 ) 477 )
OLDNEW
« build.py ('K') | « build.py ('k') | tox.ini » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld