def login(self, account): log.debug('creating fxa account') fxa_account, email_account = helpers.get_fxa_account() log.debug('calling login/start to generate fxa_state') response = self.client.get( reverse('accounts.login_start'), allow_redirects=False) params = dict(urlparse.parse_qsl(response.headers['Location'])) fxa_state = params['state'] log.debug('Get browser id session token') fxa_session = helpers.get_fxa_client().login( email=fxa_account.email, password=fxa_account.password) oauth_client = fxa_oauth.Client( client_id=FXA_CONFIG['client_id'], client_secret=FXA_CONFIG['client_secret'], server_url=FXA_CONFIG['oauth_host']) log.debug('convert browser id session token into oauth code') oauth_code = oauth_client.authorize_code(fxa_session, scope='profile') # Now authenticate the user, this will verify the user on the response = self.client.get( reverse('accounts.authenticate'), params={ 'state': fxa_state, 'code': oauth_code, } )
def login(self, account): log.debug('creating fxa account') fxa_account, email_account = helpers.get_fxa_account() log.debug('calling login/start to generate fxa_state') response = self.client.get(reverse('accounts.login_start'), allow_redirects=False) params = dict(urlparse.parse_qsl(response.headers['Location'])) fxa_state = params['state'] log.debug('Get browser id session token') fxa_session = helpers.get_fxa_client().login( email=fxa_account.email, password=fxa_account.password) oauth_client = fxa_oauth.Client( client_id=FXA_CONFIG['client_id'], client_secret=FXA_CONFIG['client_secret'], server_url=FXA_CONFIG['oauth_host']) log.debug('convert browser id session token into oauth code') oauth_code = oauth_client.authorize_code(fxa_session, scope='profile') # Now authenticate the user, this will verify the user on the response = self.client.get(reverse('accounts.authenticate'), params={ 'state': fxa_state, 'code': oauth_code, })
def on_start(self): self.fxa_account, self.email_account = helpers.get_fxa_account() log.info( 'Created {account} for load-tests' .format(account=self.fxa_account)) # Slightly weighted self.app = random.choice( ['firefox'] * 20 + ['thunderbird'] * 5 + ['seamonkey'] * 1) # Only take a sub-set of languages, doesn't really matter only # increases variance and may circumvent some caches here and there self.user_language = random.choice(( 'af', 'de', 'dsb', 'en-US', 'hsb', 'ru', 'tr', 'zh-CN', 'zh-TW' )) self.is_legacy_page = self.app in ('thunderbird', 'seamonkey')
def on_start(self): self.fxa_account, self.email_account = helpers.get_fxa_account() log.info( 'Created {account} for load-tests' .format(account=self.fxa_account))
def on_start(self): self.fxa_account, self.email_account = helpers.get_fxa_account() log.info('Created {account} for load-tests'.format( account=self.fxa_account))
def on_start(self): self.fxa_account, self.email_account = helpers.get_fxa_account() log.info(f'Created {self.fxa_account} for load-tests')