license, openGraph tests: convert to testify (#12919)
Этот коммит содержится в:
коммит произвёл
Ben Schumacher
родитель
8c3dcadbd7
Коммит
6f6eb13a47
@@ -7,10 +7,10 @@ import (
|
||||
"fmt"
|
||||
"net/http"
|
||||
"net/http/httptest"
|
||||
"strings"
|
||||
|
||||
"testing"
|
||||
|
||||
"github.com/stretchr/testify/require"
|
||||
|
||||
"github.com/mattermost/mattermost-server/model"
|
||||
)
|
||||
|
||||
@@ -61,19 +61,12 @@ func TestGetOpenGraphMetadata(t *testing.T) {
|
||||
|
||||
openGraph, resp := Client.OpenGraph(ts.URL + data["path"].(string))
|
||||
CheckNoError(t, resp)
|
||||
if strings.Compare(openGraph["title"], data["title"].(string)) != 0 {
|
||||
t.Fatal(fmt.Sprintf(
|
||||
"OG data title mismatch for path \"%s\". Expected title: \"%s\". Actual title: \"%s\"",
|
||||
data["path"].(string), data["title"].(string), openGraph["title"],
|
||||
))
|
||||
}
|
||||
|
||||
if ogDataCacheMissCount != data["cacheMissCount"].(int) {
|
||||
t.Fatal(fmt.Sprintf(
|
||||
"Cache miss count didn't match. Expected value %d. Actual value %d.",
|
||||
data["cacheMissCount"].(int), ogDataCacheMissCount,
|
||||
))
|
||||
}
|
||||
require.Equalf(t, openGraph["title"], data["title"].(string),
|
||||
"OG data title mismatch for path \"%s\".")
|
||||
|
||||
require.Equal(t, ogDataCacheMissCount, data["cacheMissCount"].(int),
|
||||
"Cache miss count didn't match.")
|
||||
}
|
||||
|
||||
th.App.UpdateConfig(func(cfg *model.Config) { *cfg.ServiceSettings.EnableLinkPreviews = false })
|
||||
|
||||
Ссылка в новой задаче
Block a user