2fas-server/tests/system/api_test.go

20 lines
494 B
Go
Raw Normal View History

2022-12-31 10:22:38 +01:00
package tests
import (
"github.com/stretchr/testify/assert"
2023-01-30 19:59:42 +01:00
"github.com/twofas/2fas-server/tests"
2022-12-31 10:22:38 +01:00
"io/ioutil"
"testing"
)
func Test_Default404Response(t *testing.T) {
response := tests.DoGet("some/not/existing/endpoint", nil)
rawBody, _ := ioutil.ReadAll(response.Body)
expected := `{"Code":404,"Type":"NotFound","Description":"Requested resource can not be found","Reason":"URI not found"}`
assert.Equal(t, 404, response.StatusCode)
assert.JSONEq(t, expected, string(rawBody))
}