Merge branch 'master' into mark-as-unread
Этот коммит содержится в:
@@ -9,12 +9,12 @@ import (
|
||||
_ "image/gif"
|
||||
"testing"
|
||||
|
||||
"github.com/stretchr/testify/assert"
|
||||
"github.com/stretchr/testify/require"
|
||||
|
||||
"github.com/mattermost/mattermost-server/app"
|
||||
"github.com/mattermost/mattermost-server/model"
|
||||
"github.com/mattermost/mattermost-server/utils"
|
||||
|
||||
"github.com/stretchr/testify/assert"
|
||||
"github.com/stretchr/testify/require"
|
||||
)
|
||||
|
||||
func TestCreateEmoji(t *testing.T) {
|
||||
@@ -46,9 +46,7 @@ func TestCreateEmoji(t *testing.T) {
|
||||
// try to create a valid gif emoji when they're enabled
|
||||
newEmoji, resp := Client.CreateEmoji(emoji, utils.CreateTestGif(t, 10, 10), "image.gif")
|
||||
CheckNoError(t, resp)
|
||||
if newEmoji.Name != emoji.Name {
|
||||
t.Fatal("create with wrong name")
|
||||
}
|
||||
require.Equal(t, newEmoji.Name, emoji.Name, "create with wrong name")
|
||||
|
||||
// try to create an emoji with a duplicate name
|
||||
emoji2 := &model.Emoji{
|
||||
@@ -67,9 +65,7 @@ func TestCreateEmoji(t *testing.T) {
|
||||
|
||||
newEmoji, resp = Client.CreateEmoji(emoji, utils.CreateTestAnimatedGif(t, 10, 10, 10), "image.gif")
|
||||
CheckNoError(t, resp)
|
||||
if newEmoji.Name != emoji.Name {
|
||||
t.Fatal("create with wrong name")
|
||||
}
|
||||
require.Equal(t, newEmoji.Name, emoji.Name, "create with wrong name")
|
||||
|
||||
// try to create a valid jpeg emoji
|
||||
emoji = &model.Emoji{
|
||||
@@ -79,9 +75,7 @@ func TestCreateEmoji(t *testing.T) {
|
||||
|
||||
newEmoji, resp = Client.CreateEmoji(emoji, utils.CreateTestJpeg(t, 10, 10), "image.gif")
|
||||
CheckNoError(t, resp)
|
||||
if newEmoji.Name != emoji.Name {
|
||||
t.Fatal("create with wrong name")
|
||||
}
|
||||
require.Equal(t, newEmoji.Name, emoji.Name, "create with wrong name")
|
||||
|
||||
// try to create a valid png emoji
|
||||
emoji = &model.Emoji{
|
||||
@@ -91,9 +85,7 @@ func TestCreateEmoji(t *testing.T) {
|
||||
|
||||
newEmoji, resp = Client.CreateEmoji(emoji, utils.CreateTestPng(t, 10, 10), "image.gif")
|
||||
CheckNoError(t, resp)
|
||||
if newEmoji.Name != emoji.Name {
|
||||
t.Fatal("create with wrong name")
|
||||
}
|
||||
require.Equal(t, newEmoji.Name, emoji.Name, "create with wrong name")
|
||||
|
||||
// try to create an emoji that's too wide
|
||||
emoji = &model.Emoji{
|
||||
@@ -103,9 +95,7 @@ func TestCreateEmoji(t *testing.T) {
|
||||
|
||||
newEmoji, resp = Client.CreateEmoji(emoji, utils.CreateTestGif(t, 1000, 10), "image.gif")
|
||||
CheckNoError(t, resp)
|
||||
if newEmoji.Name != emoji.Name {
|
||||
t.Fatal("create with wrong name")
|
||||
}
|
||||
require.Equal(t, newEmoji.Name, emoji.Name, "create with wrong name")
|
||||
|
||||
// try to create an emoji that's too wide
|
||||
emoji = &model.Emoji{
|
||||
@@ -114,9 +104,7 @@ func TestCreateEmoji(t *testing.T) {
|
||||
}
|
||||
|
||||
newEmoji, resp = Client.CreateEmoji(emoji, utils.CreateTestGif(t, 10, app.MaxEmojiOriginalWidth+1), "image.gif")
|
||||
if resp.Error == nil {
|
||||
t.Fatal("should fail - emoji is too wide")
|
||||
}
|
||||
require.Error(t, resp.Error, "should fail - emoji is too wide")
|
||||
|
||||
// try to create an emoji that's too tall
|
||||
emoji = &model.Emoji{
|
||||
@@ -125,9 +113,7 @@ func TestCreateEmoji(t *testing.T) {
|
||||
}
|
||||
|
||||
newEmoji, resp = Client.CreateEmoji(emoji, utils.CreateTestGif(t, app.MaxEmojiOriginalHeight+1, 10), "image.gif")
|
||||
if resp.Error == nil {
|
||||
t.Fatal("should fail - emoji is too tall")
|
||||
}
|
||||
require.Error(t, resp.Error, "should fail - emoji is too tall")
|
||||
|
||||
// try to create an emoji that's too large
|
||||
emoji = &model.Emoji{
|
||||
@@ -136,9 +122,7 @@ func TestCreateEmoji(t *testing.T) {
|
||||
}
|
||||
|
||||
_, resp = Client.CreateEmoji(emoji, utils.CreateTestAnimatedGif(t, 100, 100, 10000), "image.gif")
|
||||
if resp.Error == nil {
|
||||
t.Fatal("should fail - emoji is too big")
|
||||
}
|
||||
require.Error(t, resp.Error, "should fail - emoji is too big")
|
||||
|
||||
// try to create an emoji with data that isn't an image
|
||||
emoji = &model.Emoji{
|
||||
@@ -224,9 +208,7 @@ func TestGetEmojiList(t *testing.T) {
|
||||
break
|
||||
}
|
||||
}
|
||||
if !found {
|
||||
t.Fatalf("failed to get emoji with id %v, %v", emoji.Id, len(listEmoji))
|
||||
}
|
||||
require.Truef(t, found, "failed to get emoji with id %v, %v", emoji.Id, len(listEmoji))
|
||||
}
|
||||
|
||||
_, resp = Client.DeleteEmoji(emojis[0].Id)
|
||||
@@ -245,16 +227,12 @@ func TestGetEmojiList(t *testing.T) {
|
||||
listEmoji, resp = Client.GetEmojiList(0, 1)
|
||||
CheckNoError(t, resp)
|
||||
|
||||
if len(listEmoji) != 1 {
|
||||
t.Fatal("should only return 1")
|
||||
}
|
||||
require.Len(t, listEmoji, 1, "should only return 1")
|
||||
|
||||
listEmoji, resp = Client.GetSortedEmojiList(0, 100, model.EMOJI_SORT_BY_NAME)
|
||||
CheckNoError(t, resp)
|
||||
|
||||
if len(listEmoji) == 0 {
|
||||
t.Fatal("should return more than 0")
|
||||
}
|
||||
require.Greater(t, len(listEmoji), 0, "should return more than 0")
|
||||
}
|
||||
|
||||
func TestDeleteEmoji(t *testing.T) {
|
||||
@@ -283,14 +261,11 @@ func TestDeleteEmoji(t *testing.T) {
|
||||
|
||||
ok, resp := Client.DeleteEmoji(newEmoji.Id)
|
||||
CheckNoError(t, resp)
|
||||
if !ok {
|
||||
t.Fatal("should return true")
|
||||
} else {
|
||||
_, err := Client.GetEmoji(newEmoji.Id)
|
||||
if err == nil {
|
||||
t.Fatal("should not return the emoji it was deleted")
|
||||
}
|
||||
}
|
||||
require.True(t, ok, "delete did not return OK")
|
||||
|
||||
_, resp = Client.GetEmoji(newEmoji.Id)
|
||||
require.NotNil(t, resp, "nil response")
|
||||
require.Error(t, resp.Error, "expected error fetching deleted emoji")
|
||||
|
||||
//Admin can delete other users emoji
|
||||
newEmoji, resp = Client.CreateEmoji(emoji, utils.CreateTestGif(t, 10, 10), "image.gif")
|
||||
@@ -298,14 +273,11 @@ func TestDeleteEmoji(t *testing.T) {
|
||||
|
||||
ok, resp = th.SystemAdminClient.DeleteEmoji(newEmoji.Id)
|
||||
CheckNoError(t, resp)
|
||||
if !ok {
|
||||
t.Fatal("should return true")
|
||||
} else {
|
||||
_, err := th.SystemAdminClient.GetEmoji(newEmoji.Id)
|
||||
if err == nil {
|
||||
t.Fatal("should not return the emoji it was deleted")
|
||||
}
|
||||
}
|
||||
require.True(t, ok, "delete did not return OK")
|
||||
|
||||
_, resp = th.SystemAdminClient.GetEmoji(newEmoji.Id)
|
||||
require.NotNil(t, resp, "nil response")
|
||||
require.Error(t, resp.Error, "expected error fetching deleted emoji")
|
||||
|
||||
// Try to delete just deleted emoji
|
||||
_, resp = Client.DeleteEmoji(newEmoji.Id)
|
||||
@@ -445,9 +417,7 @@ func TestGetEmoji(t *testing.T) {
|
||||
|
||||
emoji, resp = Client.GetEmoji(newEmoji.Id)
|
||||
CheckNoError(t, resp)
|
||||
if emoji.Id != newEmoji.Id {
|
||||
t.Fatal("wrong emoji was returned")
|
||||
}
|
||||
require.Equal(t, newEmoji.Id, emoji.Id, "wrong emoji was returned")
|
||||
|
||||
_, resp = Client.GetEmoji(model.NewId())
|
||||
CheckNotFoundStatus(t, resp)
|
||||
@@ -506,15 +476,11 @@ func TestGetEmojiImage(t *testing.T) {
|
||||
|
||||
emojiImage, resp := Client.GetEmojiImage(emoji1.Id)
|
||||
CheckNoError(t, resp)
|
||||
if len(emojiImage) <= 0 {
|
||||
t.Fatal("should return the image")
|
||||
}
|
||||
require.Greater(t, len(emojiImage), 0, "should return the image")
|
||||
|
||||
_, imageType, err := image.DecodeConfig(bytes.NewReader(emojiImage))
|
||||
if err != nil {
|
||||
t.Fatalf("unable to identify received image: %v", err.Error())
|
||||
} else if imageType != "gif" {
|
||||
t.Fatal("should've received gif data")
|
||||
}
|
||||
require.NoError(t, err)
|
||||
require.Equal(t, imageType, "gif", "expected gif")
|
||||
|
||||
emoji2 := &model.Emoji{
|
||||
CreatorId: th.BasicUser.Id,
|
||||
@@ -526,15 +492,11 @@ func TestGetEmojiImage(t *testing.T) {
|
||||
|
||||
emojiImage, resp = Client.GetEmojiImage(emoji2.Id)
|
||||
CheckNoError(t, resp)
|
||||
if len(emojiImage) <= 0 {
|
||||
t.Fatal("should return the image")
|
||||
}
|
||||
require.Greater(t, len(emojiImage), 0, "no image returned")
|
||||
|
||||
_, imageType, err = image.DecodeConfig(bytes.NewReader(emojiImage))
|
||||
if err != nil {
|
||||
t.Fatalf("unable to identify received image: %v", err.Error())
|
||||
} else if imageType != "gif" {
|
||||
t.Fatal("should've received gif data")
|
||||
}
|
||||
require.NoError(t, err, "unable to indentify received image")
|
||||
require.Equal(t, imageType, "gif", "expected gif")
|
||||
|
||||
emoji3 := &model.Emoji{
|
||||
CreatorId: th.BasicUser.Id,
|
||||
@@ -545,15 +507,11 @@ func TestGetEmojiImage(t *testing.T) {
|
||||
|
||||
emojiImage, resp = Client.GetEmojiImage(emoji3.Id)
|
||||
CheckNoError(t, resp)
|
||||
if len(emojiImage) <= 0 {
|
||||
t.Fatal("should return the image")
|
||||
}
|
||||
require.Greater(t, len(emojiImage), 0, "no image returned")
|
||||
|
||||
_, imageType, err = image.DecodeConfig(bytes.NewReader(emojiImage))
|
||||
if err != nil {
|
||||
t.Fatalf("unable to identify received image: %v", err.Error())
|
||||
} else if imageType != "jpeg" {
|
||||
t.Fatal("should've received gif data")
|
||||
}
|
||||
require.NoError(t, err, "unable to indentify received image")
|
||||
require.Equal(t, imageType, "jpeg", "expected jpeg")
|
||||
|
||||
emoji4 := &model.Emoji{
|
||||
CreatorId: th.BasicUser.Id,
|
||||
@@ -564,15 +522,11 @@ func TestGetEmojiImage(t *testing.T) {
|
||||
|
||||
emojiImage, resp = Client.GetEmojiImage(emoji4.Id)
|
||||
CheckNoError(t, resp)
|
||||
if len(emojiImage) <= 0 {
|
||||
t.Fatal("should return the image")
|
||||
}
|
||||
require.Greater(t, len(emojiImage), 0, "no image returned")
|
||||
|
||||
_, imageType, err = image.DecodeConfig(bytes.NewReader(emojiImage))
|
||||
if err != nil {
|
||||
t.Fatalf("unable to identify received image: %v", err.Error())
|
||||
} else if imageType != "png" {
|
||||
t.Fatal("should've received gif data")
|
||||
}
|
||||
require.NoError(t, err, "unable to idenitify received image")
|
||||
require.Equal(t, imageType, "png", "expected png")
|
||||
|
||||
_, resp = Client.DeleteEmoji(emoji4.Id)
|
||||
CheckNoError(t, resp)
|
||||
|
||||
@@ -27,8 +27,11 @@ func (th *testHandler) ServeHTTP(w http.ResponseWriter, r *http.Request) {
|
||||
assert.NotEmpty(th.t, string(bb))
|
||||
poir := model.PostActionIntegrationRequestFromJson(bytes.NewReader(bb))
|
||||
assert.NotEmpty(th.t, poir.UserId)
|
||||
assert.NotEmpty(th.t, poir.UserName)
|
||||
assert.NotEmpty(th.t, poir.ChannelId)
|
||||
assert.Empty(th.t, poir.TeamId)
|
||||
assert.NotEmpty(th.t, poir.ChannelName)
|
||||
assert.NotEmpty(th.t, poir.TeamId)
|
||||
assert.NotEmpty(th.t, poir.TeamName)
|
||||
assert.NotEmpty(th.t, poir.PostId)
|
||||
assert.NotEmpty(th.t, poir.TriggerId)
|
||||
assert.Equal(th.t, "button", poir.Type)
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -6,10 +6,11 @@ package api4
|
||||
import (
|
||||
"io/ioutil"
|
||||
"net/http"
|
||||
"strconv"
|
||||
"testing"
|
||||
|
||||
"github.com/mattermost/mattermost-server/model"
|
||||
"github.com/stretchr/testify/assert"
|
||||
"github.com/stretchr/testify/require"
|
||||
)
|
||||
|
||||
func TestCreateOAuthApp(t *testing.T) {
|
||||
@@ -35,21 +36,14 @@ func TestCreateOAuthApp(t *testing.T) {
|
||||
rapp, resp := AdminClient.CreateOAuthApp(oapp)
|
||||
CheckNoError(t, resp)
|
||||
CheckCreatedStatus(t, resp)
|
||||
|
||||
if rapp.Name != oapp.Name {
|
||||
t.Fatal("names did not match")
|
||||
}
|
||||
|
||||
if rapp.IsTrusted != oapp.IsTrusted {
|
||||
t.Fatal("trusted did no match")
|
||||
}
|
||||
assert.Equal(t, oapp.Name, rapp.Name, "names did not match")
|
||||
assert.Equal(t, oapp.IsTrusted, rapp.IsTrusted, "trusted did no match")
|
||||
|
||||
// Revoke permission from regular users.
|
||||
th.RemovePermissionFromRole(model.PERMISSION_MANAGE_OAUTH.Id, model.SYSTEM_USER_ROLE_ID)
|
||||
|
||||
_, resp = Client.CreateOAuthApp(oapp)
|
||||
CheckForbiddenStatus(t, resp)
|
||||
|
||||
// Grant permission to regular users.
|
||||
th.AddPermissionToRole(model.PERMISSION_MANAGE_OAUTH.Id, model.SYSTEM_USER_ROLE_ID)
|
||||
|
||||
@@ -57,23 +51,15 @@ func TestCreateOAuthApp(t *testing.T) {
|
||||
CheckNoError(t, resp)
|
||||
CheckCreatedStatus(t, resp)
|
||||
|
||||
if rapp.IsTrusted {
|
||||
t.Fatal("trusted should be false - created by non admin")
|
||||
}
|
||||
assert.False(t, rapp.IsTrusted, "trusted should be false - created by non admin")
|
||||
|
||||
oapp.Name = ""
|
||||
_, resp = AdminClient.CreateOAuthApp(oapp)
|
||||
CheckBadRequestStatus(t, resp)
|
||||
|
||||
if r, err := Client.DoApiPost("/oauth/apps", "garbage"); err == nil {
|
||||
t.Fatal("should have failed")
|
||||
} else {
|
||||
if r.StatusCode != http.StatusBadRequest {
|
||||
t.Log("actual: " + strconv.Itoa(r.StatusCode))
|
||||
t.Log("expected: " + strconv.Itoa(http.StatusBadRequest))
|
||||
t.Fatal("wrong status code")
|
||||
}
|
||||
}
|
||||
r, err := Client.DoApiPost("/oauth/apps", "garbage")
|
||||
require.Error(t, err, "expected error from garbage post")
|
||||
assert.Equal(t, http.StatusBadRequest, r.StatusCode)
|
||||
|
||||
Client.Logout()
|
||||
_, resp = Client.CreateOAuthApp(oapp)
|
||||
@@ -122,54 +108,22 @@ func TestUpdateOAuthApp(t *testing.T) {
|
||||
|
||||
updatedApp, resp := AdminClient.UpdateOAuthApp(oapp)
|
||||
CheckNoError(t, resp)
|
||||
|
||||
if updatedApp.Id != oapp.Id {
|
||||
t.Fatal("Id should have not updated")
|
||||
}
|
||||
|
||||
if updatedApp.CreatorId != oapp.CreatorId {
|
||||
t.Fatal("CreatorId should have not updated")
|
||||
}
|
||||
|
||||
if updatedApp.CreateAt != oapp.CreateAt {
|
||||
t.Fatal("CreateAt should have not updated")
|
||||
}
|
||||
|
||||
if updatedApp.UpdateAt == oapp.UpdateAt {
|
||||
t.Fatal("UpdateAt should have updated")
|
||||
}
|
||||
|
||||
if updatedApp.ClientSecret != oapp.ClientSecret {
|
||||
t.Fatal("ClientSecret should have not updated")
|
||||
}
|
||||
|
||||
if updatedApp.Name != oapp.Name {
|
||||
t.Fatal("Name should have updated")
|
||||
}
|
||||
|
||||
if updatedApp.Description != oapp.Description {
|
||||
t.Fatal("Description should have updated")
|
||||
}
|
||||
|
||||
if updatedApp.IconURL != oapp.IconURL {
|
||||
t.Fatal("IconURL should have updated")
|
||||
}
|
||||
assert.Equal(t, oapp.Id, updatedApp.Id, "Id should have not updated")
|
||||
assert.Equal(t, oapp.CreatorId, updatedApp.CreatorId, "CreatorId should have not updated")
|
||||
assert.Equal(t, oapp.CreateAt, updatedApp.CreateAt, "CreateAt should have not updated")
|
||||
assert.NotEqual(t, oapp.UpdateAt, updatedApp.UpdateAt, "UpdateAt should have updated")
|
||||
assert.Equal(t, oapp.ClientSecret, updatedApp.ClientSecret, "ClientSecret should have not updated")
|
||||
assert.Equal(t, oapp.Name, updatedApp.Name, "Name should have updated")
|
||||
assert.Equal(t, oapp.Description, updatedApp.Description, "Description should have updated")
|
||||
assert.Equal(t, oapp.IconURL, updatedApp.IconURL, "IconURL should have updated")
|
||||
|
||||
if len(updatedApp.CallbackUrls) == len(oapp.CallbackUrls) {
|
||||
for i, callbackUrl := range updatedApp.CallbackUrls {
|
||||
if callbackUrl != oapp.CallbackUrls[i] {
|
||||
t.Fatal("Description should have updated")
|
||||
}
|
||||
assert.Equal(t, oapp.CallbackUrls[i], callbackUrl, "Description should have updated")
|
||||
}
|
||||
}
|
||||
|
||||
if updatedApp.Homepage != oapp.Homepage {
|
||||
t.Fatal("Homepage should have updated")
|
||||
}
|
||||
|
||||
if updatedApp.IsTrusted != oapp.IsTrusted {
|
||||
t.Fatal("IsTrusted should have updated")
|
||||
}
|
||||
assert.Equal(t, oapp.Homepage, updatedApp.Homepage, "Homepage should have updated")
|
||||
assert.Equal(t, oapp.IsTrusted, updatedApp.IsTrusted, "IsTrusted should have updated")
|
||||
|
||||
th.LoginBasic2()
|
||||
updatedApp.CreatorId = th.BasicUser2.Id
|
||||
@@ -241,24 +195,16 @@ func TestGetOAuthApps(t *testing.T) {
|
||||
found2 = true
|
||||
}
|
||||
}
|
||||
|
||||
if !found1 || !found2 {
|
||||
t.Fatal("missing oauth app")
|
||||
}
|
||||
assert.Truef(t, found1, "missing oauth app %v", rapp.Id)
|
||||
assert.Truef(t, found2, "missing oauth app %v", rapp2.Id)
|
||||
|
||||
apps, resp = AdminClient.GetOAuthApps(1, 1)
|
||||
CheckNoError(t, resp)
|
||||
|
||||
if len(apps) != 1 {
|
||||
t.Fatal("paging failed")
|
||||
}
|
||||
require.Equal(t, 1, len(apps), "paging failed")
|
||||
|
||||
apps, resp = Client.GetOAuthApps(0, 1000)
|
||||
CheckNoError(t, resp)
|
||||
|
||||
if len(apps) != 1 && apps[0].Id != rapp2.Id {
|
||||
t.Fatal("wrong apps returned")
|
||||
}
|
||||
require.True(t, len(apps) == 1 || apps[0].Id == rapp2.Id, "wrong apps returned")
|
||||
|
||||
// Revoke permission from regular users.
|
||||
th.RemovePermissionFromRole(model.PERMISSION_MANAGE_OAUTH.Id, model.SYSTEM_USER_ROLE_ID)
|
||||
@@ -304,25 +250,13 @@ func TestGetOAuthApp(t *testing.T) {
|
||||
|
||||
rrapp, resp := AdminClient.GetOAuthApp(rapp.Id)
|
||||
CheckNoError(t, resp)
|
||||
|
||||
if rapp.Id != rrapp.Id {
|
||||
t.Fatal("wrong app")
|
||||
}
|
||||
|
||||
if rrapp.ClientSecret == "" {
|
||||
t.Fatal("should not be sanitized")
|
||||
}
|
||||
assert.Equal(t, rapp.Id, rrapp.Id, "wrong app")
|
||||
assert.NotEqual(t, "", rrapp.ClientSecret, "should not be sanitized")
|
||||
|
||||
rrapp2, resp := AdminClient.GetOAuthApp(rapp2.Id)
|
||||
CheckNoError(t, resp)
|
||||
|
||||
if rapp2.Id != rrapp2.Id {
|
||||
t.Fatal("wrong app")
|
||||
}
|
||||
|
||||
if rrapp2.ClientSecret == "" {
|
||||
t.Fatal("should not be sanitized")
|
||||
}
|
||||
assert.Equal(t, rapp2.Id, rrapp2.Id, "wrong app")
|
||||
assert.NotEqual(t, "", rrapp2.ClientSecret, "should not be sanitized")
|
||||
|
||||
_, resp = Client.GetOAuthApp(rapp2.Id)
|
||||
CheckNoError(t, resp)
|
||||
@@ -380,25 +314,13 @@ func TestGetOAuthAppInfo(t *testing.T) {
|
||||
|
||||
rrapp, resp := AdminClient.GetOAuthAppInfo(rapp.Id)
|
||||
CheckNoError(t, resp)
|
||||
|
||||
if rapp.Id != rrapp.Id {
|
||||
t.Fatal("wrong app")
|
||||
}
|
||||
|
||||
if rrapp.ClientSecret != "" {
|
||||
t.Fatal("should be sanitized")
|
||||
}
|
||||
assert.Equal(t, rapp.Id, rrapp.Id, "wrong app")
|
||||
assert.Equal(t, "", rrapp.ClientSecret, "should be sanitized")
|
||||
|
||||
rrapp2, resp := AdminClient.GetOAuthAppInfo(rapp2.Id)
|
||||
CheckNoError(t, resp)
|
||||
|
||||
if rapp2.Id != rrapp2.Id {
|
||||
t.Fatal("wrong app")
|
||||
}
|
||||
|
||||
if rrapp2.ClientSecret != "" {
|
||||
t.Fatal("should be sanitized")
|
||||
}
|
||||
assert.Equal(t, rapp2.Id, rrapp2.Id, "wrong app")
|
||||
assert.Equal(t, "", rrapp2.ClientSecret, "should be sanitized")
|
||||
|
||||
_, resp = Client.GetOAuthAppInfo(rapp2.Id)
|
||||
CheckNoError(t, resp)
|
||||
@@ -456,10 +378,7 @@ func TestDeleteOAuthApp(t *testing.T) {
|
||||
|
||||
pass, resp := AdminClient.DeleteOAuthApp(rapp.Id)
|
||||
CheckNoError(t, resp)
|
||||
|
||||
if !pass {
|
||||
t.Fatal("should have passed")
|
||||
}
|
||||
assert.True(t, pass, "should have passed")
|
||||
|
||||
_, resp = AdminClient.DeleteOAuthApp(rapp2.Id)
|
||||
CheckNoError(t, resp)
|
||||
@@ -526,14 +445,8 @@ func TestRegenerateOAuthAppSecret(t *testing.T) {
|
||||
|
||||
rrapp, resp := AdminClient.RegenerateOAuthAppSecret(rapp.Id)
|
||||
CheckNoError(t, resp)
|
||||
|
||||
if rrapp.Id != rapp.Id {
|
||||
t.Fatal("wrong app")
|
||||
}
|
||||
|
||||
if rrapp.ClientSecret == rapp.ClientSecret {
|
||||
t.Fatal("secret didn't change")
|
||||
}
|
||||
assert.Equal(t, rrapp.Id, rapp.Id, "wrong app")
|
||||
assert.NotEqual(t, rapp.ClientSecret, rrapp.ClientSecret, "secret didn't change")
|
||||
|
||||
_, resp = AdminClient.RegenerateOAuthAppSecret(rapp2.Id)
|
||||
CheckNoError(t, resp)
|
||||
@@ -608,15 +521,9 @@ func TestGetAuthorizedOAuthAppsForUser(t *testing.T) {
|
||||
if a.Id == rapp.Id {
|
||||
found = true
|
||||
}
|
||||
|
||||
if a.ClientSecret != "" {
|
||||
t.Fatal("not sanitized")
|
||||
}
|
||||
}
|
||||
|
||||
if !found {
|
||||
t.Fatal("missing app")
|
||||
assert.Equal(t, "", a.ClientSecret, "not sanitized")
|
||||
}
|
||||
require.True(t, found, "missing app")
|
||||
|
||||
_, resp = Client.GetAuthorizedOAuthAppsForUser(th.BasicUser2.Id, 0, 1000)
|
||||
CheckForbiddenStatus(t, resp)
|
||||
|
||||
@@ -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 })
|
||||
|
||||
@@ -1399,7 +1399,7 @@ func login(c *Context, w http.ResponseWriter, r *http.Request) {
|
||||
|
||||
c.LogAuditWithUserId(user.Id, "authenticated")
|
||||
|
||||
session, err := c.App.DoLogin(w, r, user, deviceId)
|
||||
err = c.App.DoLogin(w, r, user, deviceId)
|
||||
if err != nil {
|
||||
c.Err = err
|
||||
return
|
||||
@@ -1408,7 +1408,7 @@ func login(c *Context, w http.ResponseWriter, r *http.Request) {
|
||||
c.LogAuditWithUserId(user.Id, "success")
|
||||
|
||||
if r.Header.Get(model.HEADER_REQUESTED_WITH) == model.HEADER_REQUESTED_WITH_XML {
|
||||
c.App.AttachSessionCookies(w, r, session)
|
||||
c.App.AttachSessionCookies(w, r)
|
||||
}
|
||||
|
||||
userTermsOfService, err := c.App.GetUserTermsOfService(user.Id)
|
||||
|
||||
@@ -33,17 +33,9 @@ func TestCreateIncomingWebhook(t *testing.T) {
|
||||
rhook, resp := th.SystemAdminClient.CreateIncomingWebhook(hook)
|
||||
CheckNoError(t, resp)
|
||||
|
||||
if rhook.ChannelId != hook.ChannelId {
|
||||
t.Fatal("channel ids didn't match")
|
||||
}
|
||||
|
||||
if rhook.UserId != th.SystemAdminUser.Id {
|
||||
t.Fatal("user ids didn't match")
|
||||
}
|
||||
|
||||
if rhook.TeamId != th.BasicTeam.Id {
|
||||
t.Fatal("team ids didn't match")
|
||||
}
|
||||
require.Equal(t, hook.ChannelId, rhook.ChannelId, "channel ids didn't match")
|
||||
require.Equal(t, th.SystemAdminUser.Id, rhook.UserId, "user ids didn't match")
|
||||
require.Equal(t, th.BasicTeam.Id, rhook.TeamId, "team ids didn't match")
|
||||
|
||||
hook.ChannelId = "junk"
|
||||
_, resp = th.SystemAdminClient.CreateIncomingWebhook(hook)
|
||||
@@ -136,16 +128,12 @@ func TestGetIncomingWebhooks(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
if !found {
|
||||
t.Fatal("missing hook")
|
||||
}
|
||||
require.True(t, found, "missing hook")
|
||||
|
||||
hooks, resp = th.SystemAdminClient.GetIncomingWebhooks(0, 1, "")
|
||||
CheckNoError(t, resp)
|
||||
|
||||
if len(hooks) != 1 {
|
||||
t.Fatal("should only be 1")
|
||||
}
|
||||
require.Len(t, hooks, 1, "should only be 1 hook")
|
||||
|
||||
hooks, resp = th.SystemAdminClient.GetIncomingWebhooksForTeam(th.BasicTeam.Id, 0, 1000, "")
|
||||
CheckNoError(t, resp)
|
||||
@@ -157,16 +145,12 @@ func TestGetIncomingWebhooks(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
if !found {
|
||||
t.Fatal("missing hook")
|
||||
}
|
||||
require.True(t, found, "missing hook")
|
||||
|
||||
hooks, resp = th.SystemAdminClient.GetIncomingWebhooksForTeam(model.NewId(), 0, 1000, "")
|
||||
CheckNoError(t, resp)
|
||||
|
||||
if len(hooks) != 0 {
|
||||
t.Fatal("no hooks should be returned")
|
||||
}
|
||||
require.Len(t, hooks, 0, "no hooks should be returned")
|
||||
|
||||
_, resp = Client.GetIncomingWebhooks(0, 1000, "")
|
||||
CheckForbiddenStatus(t, resp)
|
||||
@@ -335,11 +319,10 @@ func TestDeleteIncomingWebhook(t *testing.T) {
|
||||
rhook, resp = Client.CreateIncomingWebhook(hook)
|
||||
CheckNoError(t, resp)
|
||||
|
||||
if status, resp = Client.DeleteIncomingWebhook(rhook.Id); !status {
|
||||
t.Fatal("Delete should have succeeded")
|
||||
} else {
|
||||
CheckOKStatus(t, resp)
|
||||
}
|
||||
status, resp = Client.DeleteIncomingWebhook(rhook.Id)
|
||||
require.True(t, status, "Delete should have succeeded")
|
||||
|
||||
CheckOKStatus(t, resp)
|
||||
|
||||
// Get now should not return this deleted hook
|
||||
_, resp = Client.GetIncomingWebhook(rhook.Id, "")
|
||||
@@ -378,13 +361,9 @@ func TestCreateOutgoingWebhook(t *testing.T) {
|
||||
rhook, resp := th.SystemAdminClient.CreateOutgoingWebhook(hook)
|
||||
CheckNoError(t, resp)
|
||||
|
||||
if rhook.ChannelId != hook.ChannelId {
|
||||
t.Fatal("channel ids didn't match")
|
||||
} else if rhook.CreatorId != th.SystemAdminUser.Id {
|
||||
t.Fatal("user ids didn't match")
|
||||
} else if rhook.TeamId != th.BasicChannel.TeamId {
|
||||
t.Fatal("team ids didn't match")
|
||||
}
|
||||
assert.Equal(t, hook.ChannelId, rhook.ChannelId, "channel ids didn't match")
|
||||
assert.Equal(t, th.SystemAdminUser.Id, rhook.CreatorId, "user ids didn't match")
|
||||
assert.Equal(t, th.BasicChannel.TeamId, rhook.TeamId, "team ids didn't match")
|
||||
|
||||
hook.ChannelId = "junk"
|
||||
_, resp = th.SystemAdminClient.CreateOutgoingWebhook(hook)
|
||||
@@ -436,16 +415,12 @@ func TestGetOutgoingWebhooks(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
if !found {
|
||||
t.Fatal("missing hook")
|
||||
}
|
||||
require.True(t, found, "missing hook")
|
||||
|
||||
hooks, resp = th.SystemAdminClient.GetOutgoingWebhooks(0, 1, "")
|
||||
CheckNoError(t, resp)
|
||||
|
||||
if len(hooks) != 1 {
|
||||
t.Fatal("should only be 1")
|
||||
}
|
||||
require.Len(t, hooks, 1, "should only be 1 hook")
|
||||
|
||||
hooks, resp = th.SystemAdminClient.GetOutgoingWebhooksForTeam(th.BasicTeam.Id, 0, 1000, "")
|
||||
CheckNoError(t, resp)
|
||||
@@ -457,16 +432,12 @@ func TestGetOutgoingWebhooks(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
if !found {
|
||||
t.Fatal("missing hook")
|
||||
}
|
||||
require.True(t, found, "missing hook")
|
||||
|
||||
hooks, resp = th.SystemAdminClient.GetOutgoingWebhooksForTeam(model.NewId(), 0, 1000, "")
|
||||
CheckNoError(t, resp)
|
||||
|
||||
if len(hooks) != 0 {
|
||||
t.Fatal("no hooks should be returned")
|
||||
}
|
||||
require.Len(t, hooks, 0, "no hooks should be returned")
|
||||
|
||||
hooks, resp = th.SystemAdminClient.GetOutgoingWebhooksForChannel(th.BasicChannel.Id, 0, 1000, "")
|
||||
CheckNoError(t, resp)
|
||||
@@ -478,9 +449,7 @@ func TestGetOutgoingWebhooks(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
if !found {
|
||||
t.Fatal("missing hook")
|
||||
}
|
||||
require.True(t, found, "missing hook")
|
||||
|
||||
_, resp = th.SystemAdminClient.GetOutgoingWebhooksForChannel(model.NewId(), 0, 1000, "")
|
||||
CheckForbiddenStatus(t, resp)
|
||||
@@ -647,9 +616,8 @@ func TestGetOutgoingWebhook(t *testing.T) {
|
||||
|
||||
getHook, resp := th.SystemAdminClient.GetOutgoingWebhook(rhook.Id)
|
||||
CheckNoError(t, resp)
|
||||
if getHook.Id != rhook.Id {
|
||||
t.Fatal("failed to retrieve the correct outgoing hook")
|
||||
}
|
||||
|
||||
require.Equal(t, getHook.Id, rhook.Id, "failed to retrieve the correct outgoing hook")
|
||||
|
||||
_, resp = Client.GetOutgoingWebhook(rhook.Id)
|
||||
CheckForbiddenStatus(t, resp)
|
||||
@@ -694,29 +662,13 @@ func TestUpdateIncomingHook(t *testing.T) {
|
||||
|
||||
updatedHook, resp := th.SystemAdminClient.UpdateIncomingWebhook(createdHook)
|
||||
CheckNoError(t, resp)
|
||||
if updatedHook != nil {
|
||||
if updatedHook.DisplayName != "hook2" {
|
||||
t.Fatal("Hook name is not updated")
|
||||
}
|
||||
|
||||
if updatedHook.Description != "description" {
|
||||
t.Fatal("Hook description is not updated")
|
||||
}
|
||||
|
||||
if updatedHook.ChannelId != th.BasicChannel2.Id {
|
||||
t.Fatal("Hook channel is not updated")
|
||||
}
|
||||
|
||||
if updatedHook.Username != "" {
|
||||
t.Fatal("Hook username was incorrectly updated")
|
||||
}
|
||||
|
||||
if updatedHook.IconURL != "" {
|
||||
t.Fatal("Hook icon was incorrectly updated")
|
||||
}
|
||||
} else {
|
||||
t.Fatal("should not be nil")
|
||||
}
|
||||
require.NotNil(t, updatedHook, "should not be nil")
|
||||
require.Exactly(t, "hook2", updatedHook.DisplayName, "Hook name is not updated")
|
||||
require.Exactly(t, "description", updatedHook.Description, "Hook description is not updated")
|
||||
require.Equal(t, updatedHook.ChannelId, th.BasicChannel2.Id, "Hook channel is not updated")
|
||||
require.Empty(t, updatedHook.Username, "Hook username was incorrectly updated")
|
||||
require.Empty(t, updatedHook.IconURL, "Hook icon was incorrectly updated")
|
||||
|
||||
//updatedHook, _ = th.App.GetIncomingWebhook(createdHook.Id)
|
||||
assert.Equal(t, updatedHook.ChannelId, createdHook.ChannelId)
|
||||
@@ -734,29 +686,13 @@ func TestUpdateIncomingHook(t *testing.T) {
|
||||
|
||||
updatedHook, resp := th.SystemAdminClient.UpdateIncomingWebhook(createdHook)
|
||||
CheckNoError(t, resp)
|
||||
if updatedHook != nil {
|
||||
if updatedHook.DisplayName != "hook2" {
|
||||
t.Fatal("Hook name is not updated")
|
||||
}
|
||||
|
||||
if updatedHook.Description != "description" {
|
||||
t.Fatal("Hook description is not updated")
|
||||
}
|
||||
|
||||
if updatedHook.ChannelId != th.BasicChannel2.Id {
|
||||
t.Fatal("Hook channel is not updated")
|
||||
}
|
||||
|
||||
if updatedHook.Username != "username" {
|
||||
t.Fatal("Hook username is not updated")
|
||||
}
|
||||
|
||||
if updatedHook.IconURL != "icon" {
|
||||
t.Fatal("Hook icon is not updated")
|
||||
}
|
||||
} else {
|
||||
t.Fatal("should not be nil")
|
||||
}
|
||||
require.NotNil(t, updatedHook, "should not be nil")
|
||||
require.Exactly(t, "hook2", updatedHook.DisplayName, "Hook name is not updated")
|
||||
require.Exactly(t, "description", updatedHook.Description, "Hook description is not updated")
|
||||
require.Equal(t, updatedHook.ChannelId, th.BasicChannel2.Id, "Hook channel is not updated")
|
||||
require.Exactly(t, "username", updatedHook.Username, "Hook username is not updated")
|
||||
require.Exactly(t, "icon", updatedHook.IconURL, "Hook icon is not updated")
|
||||
|
||||
//updatedHook, _ = th.App.GetIncomingWebhook(createdHook.Id)
|
||||
assert.Equal(t, updatedHook.ChannelId, createdHook.ChannelId)
|
||||
@@ -781,13 +717,8 @@ func TestUpdateIncomingHook(t *testing.T) {
|
||||
|
||||
updatedHook, resp := th.SystemAdminClient.UpdateIncomingWebhook(createdHook)
|
||||
CheckNoError(t, resp)
|
||||
if updatedHook != nil {
|
||||
if updatedHook.UpdateAt == createdHook.UpdateAt {
|
||||
t.Fatal("failed - hook updateAt is not updated")
|
||||
}
|
||||
} else {
|
||||
t.Fatal("should not be nil")
|
||||
}
|
||||
require.NotNil(t, updatedHook, "should not be nil")
|
||||
require.NotEqual(t, createdHook.UpdateAt, updatedHook.UpdateAt, "failed - hook updateAt is not updated")
|
||||
})
|
||||
|
||||
t.Run("UpdateNonExistentHook", func(t *testing.T) {
|
||||
@@ -837,9 +768,7 @@ func TestUpdateIncomingHook(t *testing.T) {
|
||||
t.Run("UpdateByDifferentUser", func(t *testing.T) {
|
||||
updatedHook, resp := Client.UpdateIncomingWebhook(createdHook)
|
||||
CheckNoError(t, resp)
|
||||
if updatedHook.UserId == th.BasicUser2.Id {
|
||||
t.Fatal("Hook's creator userId is not retained")
|
||||
}
|
||||
require.NotEqual(t, th.BasicUser2.Id, updatedHook.UserId, "Hook's creator userId is not retained")
|
||||
})
|
||||
|
||||
t.Run("IncomingHooksDisabled", func(t *testing.T) {
|
||||
@@ -932,9 +861,7 @@ func TestRegenOutgoingHookToken(t *testing.T) {
|
||||
|
||||
regenHookToken, resp := th.SystemAdminClient.RegenOutgoingHookToken(rhook.Id)
|
||||
CheckNoError(t, resp)
|
||||
if regenHookToken.Token == rhook.Token {
|
||||
t.Fatal("regen didn't work properly")
|
||||
}
|
||||
require.NotEqual(t, rhook.Token, regenHookToken.Token, "regen didn't work properly")
|
||||
|
||||
_, resp = Client.RegenOutgoingHookToken(rhook.Id)
|
||||
CheckForbiddenStatus(t, resp)
|
||||
@@ -969,12 +896,9 @@ func TestUpdateOutgoingHook(t *testing.T) {
|
||||
|
||||
updatedHook, resp := th.SystemAdminClient.UpdateOutgoingWebhook(createdHook)
|
||||
CheckNoError(t, resp)
|
||||
if updatedHook.DisplayName != "Cats" {
|
||||
t.Fatal("did not update")
|
||||
}
|
||||
if updatedHook.Description != "Get me some cats" {
|
||||
t.Fatal("did not update")
|
||||
}
|
||||
|
||||
require.Exactly(t, "Cats", updatedHook.DisplayName, "did not update")
|
||||
require.Exactly(t, "Get me some cats", updatedHook.Description, "did not update")
|
||||
})
|
||||
|
||||
t.Run("OutgoingHooksDisabled", func(t *testing.T) {
|
||||
@@ -995,9 +919,7 @@ func TestUpdateOutgoingHook(t *testing.T) {
|
||||
updatedHook2, resp := th.SystemAdminClient.UpdateOutgoingWebhook(createdHook2)
|
||||
CheckNoError(t, resp)
|
||||
|
||||
if updatedHook2.CreateAt != createdHook2.CreateAt {
|
||||
t.Fatal("failed - hook create at should not be changed")
|
||||
}
|
||||
require.Equal(t, createdHook2.CreateAt, updatedHook2.CreateAt, "failed - hook create at should not be changed")
|
||||
})
|
||||
|
||||
t.Run("ModifyUpdateAt", func(t *testing.T) {
|
||||
@@ -1006,9 +928,7 @@ func TestUpdateOutgoingHook(t *testing.T) {
|
||||
updatedHook2, resp := th.SystemAdminClient.UpdateOutgoingWebhook(createdHook)
|
||||
CheckNoError(t, resp)
|
||||
|
||||
if updatedHook2.UpdateAt == createdHook.UpdateAt {
|
||||
t.Fatal("failed - hook updateAt is not updated")
|
||||
}
|
||||
require.NotEqual(t, createdHook.UpdateAt, updatedHook2.UpdateAt, "failed - hook updateAt is not updated")
|
||||
})
|
||||
|
||||
t.Run("UpdateNonExistentHook", func(t *testing.T) {
|
||||
@@ -1048,12 +968,9 @@ func TestUpdateOutgoingHook(t *testing.T) {
|
||||
createdHook.DisplayName = "Basic user 2"
|
||||
updatedHook, resp := Client.UpdateOutgoingWebhook(createdHook)
|
||||
CheckNoError(t, resp)
|
||||
if updatedHook.DisplayName != "Basic user 2" {
|
||||
t.Fatal("should apply the change")
|
||||
}
|
||||
if updatedHook.CreatorId != th.SystemAdminUser.Id {
|
||||
t.Fatal("hook creator should not be changed")
|
||||
}
|
||||
|
||||
require.Exactly(t, "Basic user 2", updatedHook.DisplayName, "should apply the change")
|
||||
require.Equal(t, th.SystemAdminUser.Id, updatedHook.CreatorId, "hook creator should not be changed")
|
||||
})
|
||||
|
||||
t.Run("UpdateToExistingTriggerWordAndCallback", func(t *testing.T) {
|
||||
@@ -1167,11 +1084,10 @@ func TestDeleteOutgoingHook(t *testing.T) {
|
||||
rhook, resp = Client.CreateOutgoingWebhook(hook)
|
||||
CheckNoError(t, resp)
|
||||
|
||||
if status, resp = Client.DeleteOutgoingWebhook(rhook.Id); !status {
|
||||
t.Fatal("Delete should have succeeded")
|
||||
} else {
|
||||
CheckOKStatus(t, resp)
|
||||
}
|
||||
status, resp = Client.DeleteOutgoingWebhook(rhook.Id)
|
||||
|
||||
require.True(t, status, "Delete should have succeeded")
|
||||
CheckOKStatus(t, resp)
|
||||
|
||||
// Get now should not return this deleted hook
|
||||
_, resp = Client.GetIncomingWebhook(rhook.Id, "")
|
||||
|
||||
Ссылка в новой задаче
Block a user