parent
9142de1dd5
commit
cae9b288b0
@ -1,7 +1,13 @@ |
||||
package storage |
||||
|
||||
type ObjectStorage interface { |
||||
GetList() ([]byte, error) |
||||
List(path string) ([]ObjectDescription, error) |
||||
Get(path string) ([]byte, error) |
||||
Put(path string, object []byte) error |
||||
} |
||||
|
||||
type ObjectDescription struct { |
||||
Path string |
||||
IsDir bool |
||||
Hash string |
||||
} |
||||
|
@ -1,32 +0,0 @@ |
||||
package storage |
||||
|
||||
import ( |
||||
"fmt" |
||||
"io/ioutil" |
||||
"log" |
||||
"net/http" |
||||
"net/http/httptest" |
||||
"testing" |
||||
) |
||||
|
||||
func TestPrintsStorage(t *testing.T) { |
||||
server := httptest.NewServer(http.HandlerFunc(storageHandler)) |
||||
defer server.Close() |
||||
res, err := http.Get(server.URL) |
||||
if err != nil { |
||||
log.Fatal(err) |
||||
} |
||||
body, err := ioutil.ReadAll(res.Body) |
||||
res.Body.Close() |
||||
if err != nil { |
||||
log.Fatal(err) |
||||
} |
||||
bodyString := string(body) |
||||
if bodyString != "Storage" { |
||||
log.Fatal("Expected 'Storage', Received '" + bodyString + "'") |
||||
} |
||||
} |
||||
|
||||
func storageHandler(w http.ResponseWriter, req *http.Request) { |
||||
fmt.Fprintf(w, "Storage") |
||||
} |
Loading…
Reference in new issue