license, openGraph tests: convert to testify (#12919)

Этот коммит содержится в:
Luke Kingland
2019-10-31 20:19:19 +09:00
коммит произвёл Ben Schumacher
родитель 8c3dcadbd7
Коммит 6f6eb13a47
2 изменённых файлов: 18 добавлений и 23 удалений

Просмотреть файл

@@ -4,6 +4,8 @@ import (
"net/http"
"testing"
"github.com/stretchr/testify/require"
"github.com/mattermost/mattermost-server/model"
)
@@ -15,22 +17,22 @@ func TestGetOldClientLicense(t *testing.T) {
license, resp := Client.GetOldClientLicense("")
CheckNoError(t, resp)
if len(license["IsLicensed"]) == 0 {
t.Fatal("license not returned correctly")
}
require.NotEqual(t, license["IsLicensed"], "", "license not returned correctly")
Client.Logout()
_, resp = Client.GetOldClientLicense("")
CheckNoError(t, resp)
if _, err := Client.DoApiGet("/license/client", ""); err == nil || err.StatusCode != http.StatusNotImplemented {
t.Fatal("should have errored with 501")
}
_, err := Client.DoApiGet("/license/client", "")
require.Error(t, err, "get /license/client did not return an error")
require.Equal(t, err.StatusCode, http.StatusNotImplemented,
"expected 501 Not Implemented")
if _, err := Client.DoApiGet("/license/client?format=junk", ""); err == nil || err.StatusCode != http.StatusBadRequest {
t.Fatal("should have errored with 400")
}
_, err = Client.DoApiGet("/license/client?format=junk", "")
require.Error(t, err, "get /license/client?format=junk did not return an error")
require.Equal(t, err.StatusCode, http.StatusBadRequest,
"expected 400 Bad Request")
license, resp = th.SystemAdminClient.GetOldClientLicense("")
CheckNoError(t, resp)