def login(email=None, pw=None): """ Attempt to login. Defaults to the special testing username and password specified in util/tests/context.py. """ if email == None: email = Context.email if pw == None: pw = Context.passwd return do_post('/api/auth/login', {'email': email, 'password': pw})
def login(email=None, pw=None): """ Attempt to login. Defaults to the special testing username and password specified in util/tests/context.py. """ if email == None: email = Context.email if pw == None: pw = Context.passwd return do_post('/api/auth/login', {'email':email, 'password':pw})
def test_post_results(token, result_id, **overrides): params = {'user_token': token} params.update(get_example_data(overrides)) for key, val in params.items(): if isinstance(val, list): params[key] = json.dumps(params[key]) resp = do_post('/api/test_result/%s/edit' % str(result_id), params) check_status(resp, fields=[]) print (SUCCESS("Post Test Results data"))
def test_new_set(token): params = {'user_token':token, } resp = do_post('/api/test_set/create', params) check_status(resp, fields=['set_id']) set_id = resp.json()['set_id'] print (SUCCESS("Create new Test Set", set_id=set_id, )) return set_id
def test_start_mobile(token, set_id): print token params = {'user_token':token, 'set_id':set_id, } resp = do_post('/api/start_test/mobile', params) check_status(resp, fields=['result_id', 'config']) js = resp.json() assert_valid_config(js['config']) print (SUCCESS("Start mobile test", conf=truncate_repr(js['config']), result_id=js['result_id'] )) return js['result_id'] #, js['config']
def test_get_results(token, result_id, **overrides): params = {'user_token':token, } extra_columns = [ 'download_throughputs_avg', 'download_latencies_avg', 'upload_throughputs_avg', 'upload_latencies_avg', ] resp = do_post('/api/test_result/%s' % str(result_id), params) check_status(resp, fields=TestResult.get_public_columns().keys() + extra_columns) data = get_example_data(overrides) json_resp = resp.json() for col in data: validate_col(col, data[col], json_resp[col]) print (SUCCESS("Retrieve Test Results data", data=truncate_repr(data, priority=overrides), )) return resp.json()
def testfunc(token): """ Make a call to the api testfunc. Require a valid authentication token.""" return do_post('/api/testfunc', {"user_token": token})
def logout(token): """ Attempt to logout the user who is identified by the given token. """ return do_post('/api/auth/logout', {"user_token": token})
def create_user(email=None, pw=None): """ Create a user with the given email and password. Defaults to the testing account. """ email = email or Context.email pw = pw or Context.passwd return do_post('/api/auth/register', {'email': email, 'password': pw})
def testfunc(token): """ Make a call to the api testfunc. Require a valid authentication token.""" return do_post('/api/testfunc', {"user_token":token})
def logout(token): """ Attempt to logout the user who is identified by the given token. """ return do_post('/api/auth/logout', {"user_token":token})
def create_user(email=None, pw=None): """ Create a user with the given email and password. Defaults to the testing account. """ email = email or Context.email pw = pw or Context.passwd return do_post('/api/auth/register', {'email':email, 'password':pw})