From d4f0f8b6c0853dee57f8acd2c84476441f50c6e1 Mon Sep 17 00:00:00 2001 From: Cosmin Malutan Date: Wed, 25 Jun 2014 15:11:42 +0200 Subject: [PATCH] Bug 1028030 - Add placeholders for email and password in TPS config file. r=hskupin a=test-only DONTBUILD --- testing/tps/config/config.json.in | 10 +++---- testing/tps/create_venv.py | 48 +++++++++++++++++++++++++++++++ 2 files changed, 53 insertions(+), 5 deletions(-) diff --git a/testing/tps/config/config.json.in b/testing/tps/config/config.json.in index 0dc422e483fb..53ccb016c46b 100644 --- a/testing/tps/config/config.json.in +++ b/testing/tps/config/config.json.in @@ -1,12 +1,12 @@ { "sync_account": { - "username": "", - "password": "", - "passphrase": "" + "username": "__SYNC_ACCOUNT_USERNAME__", + "password": "__SYNC_ACCOUNT_PASSWORD__", + "passphrase": "__SYNC_ACCOUNT_PASSPHRASE__" }, "fx_account": { - "username": "", - "password": "" + "username": "__FX_ACCOUNT_USERNAME__", + "password": "__FX_ACCOUNT_PASSWORD__" }, "email": { "username": "crossweave@mozilla.com", diff --git a/testing/tps/create_venv.py b/testing/tps/create_venv.py index 79ed9d16adda..3acf0a687074 100755 --- a/testing/tps/create_venv.py +++ b/testing/tps/create_venv.py @@ -46,12 +46,43 @@ else: def main(): parser = optparse.OptionParser('Usage: %prog [options] path_to_venv') + parser.add_option('--password', + type='string', + dest='password', + metavar='FX_ACCOUNT_PASSWORD', + default=None, + help='The Firefox Account password.') parser.add_option('-p', '--python', type='string', dest='python', metavar='PYTHON_BIN', default=None, help='The Python interpreter to use.') + parser.add_option('--sync-passphrase', + type='string', + dest='sync_passphrase', + metavar='SYNC_ACCOUNT_PASSPHRASE', + default=None, + help='The old Firefox Sync account passphrase.') + parser.add_option('--sync-password', + type='string', + dest='sync_password', + metavar='SYNC_ACCOUNT_PASSWORD', + default=None, + help='The old Firefox Sync account password.') + parser.add_option('--sync-username', + type='string', + dest='sync_username', + metavar='SYNC_ACCOUNT_USERNAME', + default=None, + help='The old Firefox Sync account username.') + parser.add_option('--username', + type='string', + dest='username', + metavar='FX_ACCOUNT_USERNAME', + default=None, + help='The Firefox Account username.') + (options, args) = parser.parse_args(args=None, values=None) if len(args) != 1: @@ -91,6 +122,23 @@ def main(): # Update config file config_in_path = os.path.join(here, 'config', 'config.json.in') replacements = {'__TESTDIR__': testdir, '__EXTENSIONDIR__': extdir} + if options.username and options.password: + replacements.update({ + '__FX_ACCOUNT_USERNAME__': options.username, + '__FX_ACCOUNT_PASSWORD__': options.password}) + else: + print 'Firefox Account credentials not specified. Please update the ' \ + 'config file manually.' + + if options.sync_username and options.sync_password and options.passphrase: + replacements.update({ + '__SYNC_ACCOUNT_USERNAME__': options.sync_username, + '__SYNC_ACCOUNT_PASSWORD__': options.sync_password, + '__SYNC_ACCOUNT_PASSPHRASE__': options.sync_passphrase}) + else: + print "Firefox Sync account credentials not specified. Please " \ + "update the config file manually." + lines = [] with open(config_in_path) as config: for line in config: