mirror of
https://github.com/minio/minio.git
synced 2024-12-27 07:35:55 -05:00
33 lines
612 B
Go
33 lines
612 B
Go
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")
|
|
}
|