From 4feba8d7f91a70d847df368f4067327edb3402f0 Mon Sep 17 00:00:00 2001 From: meejah Date: Tue, 6 Aug 2019 18:17:58 -0600 Subject: [PATCH] add a --helper command-line option, and a helper-using test --- integration/conftest.py | 1 + integration/test_web.py | 31 +++++++++++++++++++++++++++++++ 2 files changed, 32 insertions(+) diff --git a/integration/conftest.py b/integration/conftest.py index 6b9e4d13b..02c5ba747 100644 --- a/integration/conftest.py +++ b/integration/conftest.py @@ -312,6 +312,7 @@ def storage_nodes(reactor, temp_dir, introducer, introducer_furl, flog_gatherer, # start all 5 nodes in parallel for x in range(5): name = 'node{}'.format(x) + web_port= 9990 + x # tub_port = 9900 + x nodes_d.append( _create_node( diff --git a/integration/test_web.py b/integration/test_web.py index 4b0639000..dd4c17a45 100644 --- a/integration/test_web.py +++ b/integration/test_web.py @@ -52,3 +52,34 @@ def test_upload_download(alice): } ) assert data == FILE_CONTENTS + + +def test_put(alice): + """ + use PUT to create a file + """ + + import time; time.sleep(10) # XXX wat + FILE_CONTENTS = "added via PUT" + + import requests + resp = requests.put( + util.node_url(alice._node_dir, "uri"), + files={ + "file": FILE_CONTENTS, + }, + ) + assert resp.text.strip().startswith("URI:CHK:") + assert resp.text.strip().endswith(":2:4:153") + + +def test_helper_status(storage_nodes): + """ + successfully GET the /helper_status page + """ + + import requests + url = util.node_url(storage_nodes[0]._node_dir, "helper_status") + print("GET {}".format(url)) + resp = requests.get(url) + print(resp.text.strip())