Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
10
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
dms3
go-dms3
Commits
47d45c7a
Commit
47d45c7a
authored
Nov 10, 2018
by
Dr Ian Preston
Committed by
Steven Allen
Nov 28, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix tests
License: MIT Signed-off-by:
Ian Preston
<
ianopolous@protonmail.com
>
parent
fd43f473
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
4 additions
and
4 deletions
+4
-4
core/corehttp/proxy_test.go
core/corehttp/proxy_test.go
+4
-4
No files found.
core/corehttp/proxy_test.go
View file @
47d45c7a
...
...
@@ -9,7 +9,7 @@ import (
)
func
TestParseRequest
(
t
*
testing
.
T
)
{
url
:=
"http://localhost:5001/p
roxy/htt
p/QmT8JtU54XSmC38xSb1XHFSMm775VuTeajg7LWWWTAwzxT/
test-name
/path/to/index.txt"
url
:=
"http://localhost:5001/p
2
p/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/p
roxy
/http/foobar"
url
:=
"http://localhost:5001/p
2p
/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 '/p
roxy
/http/foobar'"
,
t
,
"fails with invalid path"
)
assert
.
True
(
err
.
Error
()
==
"Invalid request path '/p
2p
/http/foobar'"
,
t
,
"fails with invalid path"
)
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment