Merge pull request #102 from fkautz/pr_out_adding_list_path_to_object_storage_definition_and_accompanying_definition_to_fs
commit
c7b4e14f64
@ -1,7 +1,13 @@ |
|||||||
package storage |
package storage |
||||||
|
|
||||||
type ObjectStorage interface { |
type ObjectStorage interface { |
||||||
GetList() ([]byte, error) |
List(path string) ([]ObjectDescription, error) |
||||||
Get(path string) ([]byte, error) |
Get(path string) ([]byte, error) |
||||||
Put(path string, object []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