def do_http(): http_results['get'] = yield http_get_async(url) # pick our environment (using inherited one) form_names = _form_names(http_results['get'], provider='CondaEnvProvider') form = _prefix_form(form_names, {'source': 'inherited'}) response = yield http_post_async(url, form=form) assert response.code == 200 # now do the next round of stuff (the FOO variable) http_results['post'] = yield http_post_async(url, body="")
def post_empty_form(url): response = yield http_post_async(url, body='') assert response.code == 200 body = response.body.decode('utf-8') assert "Done!" in body assert "File downloaded to " in body _verify_choices(response, ())
def post_choose_inherited_env(url): response = yield http_get_async(url) assert response.code == 200 body = response.body.decode('utf-8') assert 'activated environment' in body form_names = _form_names(response, provider='CondaEnvProvider') form = _prefix_form(form_names, {'source': 'inherited'}) response = yield http_post_async(url, form=form) assert response.code == 200
def do_http(): http_results['get_click_submit'] = get_response = yield http_get_async(url) if get_response.code != 200: raise Exception("got a bad http response " + repr(get_response)) http_results['post_click_submit'] = post_response = yield http_post_async(url, body="") assert 200 == post_response.code assert '</form>' in str(post_response.body) assert 'FOO_PASSWORD' in str(post_response.body) fill_in_password(url, post_response)
def post_do_download(url): form = _prefix_form(stuff['form_names'], {'source': 'download'}) response = yield http_post_async(url, form=form) assert response.code == 200 body = response.body.decode('utf-8') assert 'Keep value' in body stuff['form_names'] = _form_names(response) _verify_choices( response, ( # the download caused env var to be set, offer to keep it ('environ', True), # allow typing in a manual value ('variables', False)))
def post_use_env(url): dirname = capture_dirname['value'] form = _prefix_form(stuff['form_names'], { 'source': 'variables', 'value': os.path.join(dirname, 'existing_data') }) response = yield http_post_async(url, form=form) assert response.code == 200 body = response.body.decode('utf-8') assert 'Use this' in body _verify_choices( response, ( ('download', False), ('environ', False), # we've switched to the override value ('variables', True)))
def post_empty_form(url): response = yield http_post_async(url, body='') assert response.code == 200 body = response.body.decode('utf-8') # TODO: we are not currently showing the error, but the fix is over in UIServer # and not related to DownloadProvider per se, so for now this test checks for # what happens (you just see the option to try again) instead of what should happen # (it should also display the error message) assert "Download {} to {}".format('http://example.com/bar?error=true', 'bar') in body _verify_choices( response, ( # by default, perform the download ('download', True), # allow typing in a manual value ('variables', False)))
def do_http(): http_results['post_fill_in_password'] = yield http_post_async(url, form={field['name']: 'bloop'})