@cryptotaxi247 / kubo / commits / fe8ffde4c

add some additional tests for custom protocols

License: MIT Signed-off-by: Steven Allen <steven@stebalien.com>

Steven Allen committed Nov 12, 2018 at 16:18 UTC fe8ffde4c2b8adc1829e0f3a7d6b307e78f3ea2b
1 file changed +18 -1
test/sharness/t0184-http-proxy-over-p2p.sh
+18 -1
@@ -138,7 +138,8 @@ test_expect_success 'start and connect nodes' '
138 '
139
140 test_expect_success 'setup p2p listener on the receiver' '
141 - ipfsi 1 p2p listen --allow-custom-protocol /http /ip4/127.0.0.1/tcp/$WEB_SERVE_PORT
141 + ipfsi 1 p2p listen --allow-custom-protocol /http /ip4/127.0.0.1/tcp/$WEB_SERVE_PORT &&
142 + ipfsi 1 p2p listen /x/custom/http /ip4/127.0.0.1/tcp/$WEB_SERVE_PORT
143 '
144
145 test_expect_success 'setup environment' '
@@ -169,6 +170,22 @@ test_expect_success 'handle proxy http request unknown proxy peer ' '
170 curl_check_response_code 502 p2p/unknown_peer/http/index.txt
171 '
172
173 +test_expect_success 'handle proxy http request to custom protocol' '
174 + serve_http_once "THE WOODS ARE LOVELY DARK AND DEEP" &&
175 + curl_check_response_code 200 p2p/$RECEIVER_ID/x/custom/http/index.txt
176 +'
177 +teardown_remote_server
178 +
179 +test_expect_success 'handle proxy http request to missing protocol' '
180 + serve_http_once "THE WOODS ARE LOVELY DARK AND DEEP" &&
181 + curl_check_response_code 502 p2p/$RECEIVER_ID/x/missing/http/index.txt
182 +'
183 +teardown_remote_server
184 +
185 +test_expect_success 'handle proxy http request missing the /http' '
186 + curl_check_response_code 400 p2p/$RECEIVER_ID/x/custom/index.txt
187 +'
188 +
189 test_expect_success 'handle multipart/form-data http request' '
190 serve_http_once "OK" &&
191 curl_send_multipart_form_request