Commit 47d45c7a authored by Dr Ian Preston's avatar Dr Ian Preston Committed by Steven Allen

fix tests

License: MIT
Signed-off-by: default avatarIan Preston <ianopolous@protonmail.com>
parent fd43f473
......@@ -9,7 +9,7 @@ import (
)
func TestParseRequest(t *testing.T) {
url := "http://localhost:5001/proxy/http/QmT8JtU54XSmC38xSb1XHFSMm775VuTeajg7LWWWTAwzxT/test-name/path/to/index.txt"
url := "http://localhost:5001/p2p/QmT8JtU54XSmC38xSb1XHFSMm775VuTeajg7LWWWTAwzxT/http/path/to/index.txt"
req, _ := http.NewRequest("GET", url, strings.NewReader(""))
parsed, err := parseRequest(req)
......@@ -17,12 +17,12 @@ func TestParseRequest(t *testing.T) {
t.Error(err)
}
assert.True(parsed.httpPath == "path/to/index.txt", t, "proxy request path")
assert.True(parsed.name == "test-name", t, "proxy request name")
assert.True(parsed.name == "/http", t, "proxy request name")
assert.True(parsed.target == "QmT8JtU54XSmC38xSb1XHFSMm775VuTeajg7LWWWTAwzxT", t, "proxy request peer-id")
}
func TestParseRequestInvalidPath(t *testing.T) {
url := "http://localhost:5001/proxy/http/foobar"
url := "http://localhost:5001/p2p/http/foobar"
req, _ := http.NewRequest("GET", url, strings.NewReader(""))
_, err := parseRequest(req)
......@@ -30,5 +30,5 @@ func TestParseRequestInvalidPath(t *testing.T) {
t.Fail()
}
assert.True(err.Error() == "Invalid request path '/proxy/http/foobar'", t, "fails with invalid path")
assert.True(err.Error() == "Invalid request path '/p2p/http/foobar'", t, "fails with invalid path")
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment