photoprism/internal/api/websocket_test.go
Michael Mayer 5d59b50912 Sharing: ACL authorization for REST API #18
Signed-off-by: Michael Mayer <michael@liquidbytes.net>
2020-06-25 14:54:04 +02:00

23 lines
507 B
Go

package api
import (
"github.com/stretchr/testify/assert"
"net/http"
"testing"
)
func TestWebsocket(t *testing.T) {
t.Run("bad request", func(t *testing.T) {
app, router, _ := NewApiTest()
Websocket(router)
r := PerformRequest(app, "GET", "/api/v1/ws")
assert.Equal(t, http.StatusBadRequest, r.Code)
})
t.Run("router nil", func(t *testing.T) {
app, _, _ := NewApiTest()
Websocket(nil)
r := PerformRequest(app, "GET", "/api/v1/ws")
assert.Equal(t, http.StatusNotFound, r.Code)
})
}