提交 47d45c7a 作者: Dr Ian Preston 提交者: Steven Allen

fix tests

License: MIT
Signed-off-by: 's avatarIan Preston <ianopolous@protonmail.com>
上级 fd43f473
...@@ -9,7 +9,7 @@ import ( ...@@ -9,7 +9,7 @@ import (
) )
func TestParseRequest(t *testing.T) { 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("")) req, _ := http.NewRequest("GET", url, strings.NewReader(""))
parsed, err := parseRequest(req) parsed, err := parseRequest(req)
...@@ -17,12 +17,12 @@ func TestParseRequest(t *testing.T) { ...@@ -17,12 +17,12 @@ func TestParseRequest(t *testing.T) {
t.Error(err) t.Error(err)
} }
assert.True(parsed.httpPath == "path/to/index.txt", t, "proxy request path") 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") assert.True(parsed.target == "QmT8JtU54XSmC38xSb1XHFSMm775VuTeajg7LWWWTAwzxT", t, "proxy request peer-id")
} }
func TestParseRequestInvalidPath(t *testing.T) { 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("")) req, _ := http.NewRequest("GET", url, strings.NewReader(""))
_, err := parseRequest(req) _, err := parseRequest(req)
...@@ -30,5 +30,5 @@ func TestParseRequestInvalidPath(t *testing.T) { ...@@ -30,5 +30,5 @@ func TestParseRequestInvalidPath(t *testing.T) {
t.Fail() 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 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论