def test_get_account_id(): ''' Test function in c3accounts''' mapfile = os.getcwd() + '/tests/confs/account_aliases_map.txt' account = c3accounts.get_account_id( account_name='opsprod', mapfile=mapfile) assert account == '210987654321' os.environ['AWS_ACCOUNT_ID'] == '123456789012' account = c3accounts.get_account_id() assert account == '123456789012' account = c3accounts.get_account_id( account_name='opsqa', mapfile=mapfile) assert account == '123456789012'
def generate_entries(user, config): ''' Generates entries from config files ''' ini = gen_entry.read_config(config) if 'cidr-networks' in user: acct_id = 'cidr-networks' user = '******' else: (user_acct, user) = user.split('-', 1) if user_acct.isdigit(): acct_id = user_acct else: acct_id = accounts.get_account_id(user_acct) return gen_entry.gen_s3_entry(ini, user, acct_id)