2fas-server/tests/system/api_test.go
Tobiasz Heller 794a93fa8a
Fix e2e tests after separating admin api (#11)
* Fix e2e tests after separating admin api
2023-10-24 09:27:34 +02:00

23 lines
556 B
Go

package tests
import (
"io"
"testing"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
"github.com/twofas/2fas-server/tests"
)
func Test_Default404Response(t *testing.T) {
response := tests.DoAPIGet(t, "some/not/existing/endpoint", nil)
rawBody, err := io.ReadAll(response.Body)
require.NoError(t, err)
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))
}