Files
bibliomane/internal/apitest/get_appinfo_test.go

32 lines
673 B
Go

package apitest
import (
"encoding/json"
"net/http"
"net/http/httptest"
"testing"
"git.artlef.fr/PersonalLibraryManager/internal/dto"
"git.artlef.fr/PersonalLibraryManager/internal/testutils"
"github.com/stretchr/testify/assert"
)
func TestGetAppInfo_Ok(t *testing.T) {
router := testutils.TestSetup()
req, _ := http.NewRequest("GET", "/ws/appinfo", nil)
w := httptest.NewRecorder()
router.ServeHTTP(w, req)
var appInfo dto.AppInfo
err := json.Unmarshal(w.Body.Bytes(), &appInfo)
if err != nil {
t.Error(err)
}
assert.Equal(t, http.StatusOK, w.Code)
assert.Equal(t, false, appInfo.RegistrationDisabled)
assert.Equal(t, false, appInfo.DemoMode)
}