mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-07-22 20:56:42 +00:00
add tests for upload with fallback for root path
This commit is contained in:
parent
585b52c472
commit
5292414f11
1 changed files with 17 additions and 2 deletions
|
|
@ -81,7 +81,6 @@ func TestApiDirUpload(t *testing.T) {
|
|||
|
||||
content, err := ioutil.ReadFile(path.Join(testDir, "test0", "index.html"))
|
||||
testGet(t, api, path.Join(bzzhash, "index.html"), content, "text/html", 0, 202)
|
||||
testGet(t, api, bzzhash, content, "text/html", 0, 202)
|
||||
|
||||
content, err = ioutil.ReadFile(path.Join(testDir, "test0", "index.css"))
|
||||
testGet(t, api, path.Join(bzzhash, "index.css"), content, "text/plain", 0, 132)
|
||||
|
|
@ -95,6 +94,22 @@ func TestApiDirUpload(t *testing.T) {
|
|||
}
|
||||
}
|
||||
|
||||
func TestApiDirUploadWithRootFile(t *testing.T) {
|
||||
api, err := testApi()
|
||||
if err != nil {
|
||||
t.Errorf("unexpected error: %v", err)
|
||||
return
|
||||
}
|
||||
bzzhash, err := api.Upload(path.Join(testDir, "test0"), "index.html")
|
||||
if err != nil {
|
||||
t.Errorf("unexpected error: %v", err)
|
||||
return
|
||||
}
|
||||
|
||||
content, err := ioutil.ReadFile(path.Join(testDir, "test0", "index.html"))
|
||||
testGet(t, api, bzzhash, content, "text/html", 0, 202)
|
||||
}
|
||||
|
||||
func TestApiFileUpload(t *testing.T) {
|
||||
api, err := testApi()
|
||||
if err != nil {
|
||||
|
|
@ -108,5 +123,5 @@ func TestApiFileUpload(t *testing.T) {
|
|||
}
|
||||
|
||||
content, err := ioutil.ReadFile(path.Join(testDir, "test0", "index.html"))
|
||||
testGet(t, api, path.Join(bzzhash), content, "text/html", 0, 202)
|
||||
testGet(t, api, bzzhash, content, "text/html", 0, 202)
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue