diff options
author | Jesse Hallam <jesse.hallam@gmail.com> | 2018-01-03 10:35:36 -0500 |
---|---|---|
committer | Joram Wilander <jwawilander@gmail.com> | 2018-01-03 10:35:36 -0500 |
commit | e5dad3cf681fb038ce5dd3dcf7b5468d59b8ea8e (patch) | |
tree | d3040d03a076b5e3b0d991bcb5d4d703f9a45c07 /app/webhook_test.go | |
parent | 15cc4497588537f3f9b81d6f97228fae946fa008 (diff) | |
download | chat-e5dad3cf681fb038ce5dd3dcf7b5468d59b8ea8e.tar.gz chat-e5dad3cf681fb038ce5dd3dcf7b5468d59b8ea8e.tar.bz2 chat-e5dad3cf681fb038ce5dd3dcf7b5468d59b8ea8e.zip |
[PLT-8173] Strip the post_ prefix on incoming webhook overrides. (#8019)
Diffstat (limited to 'app/webhook_test.go')
-rw-r--r-- | app/webhook_test.go | 84 |
1 files changed, 42 insertions, 42 deletions
diff --git a/app/webhook_test.go b/app/webhook_test.go index 048c8361d..47303ee93 100644 --- a/app/webhook_test.go +++ b/app/webhook_test.go @@ -53,11 +53,11 @@ func TestCreateIncomingWebhookForChannel(t *testing.T) { EnablePostUsernameOverride: false, EnablePostIconOverride: false, IncomingWebhook: model.IncomingWebhook{ - DisplayName: "title", - Description: "description", - ChannelId: th.BasicChannel.Id, - PostUsername: ":invalid and ignored:", - PostIconURL: "ignored", + DisplayName: "title", + Description: "description", + ChannelId: th.BasicChannel.Id, + Username: ":invalid and ignored:", + IconURL: "ignored", }, ExpectedError: false, @@ -72,10 +72,10 @@ func TestCreateIncomingWebhookForChannel(t *testing.T) { EnablePostUsernameOverride: true, EnablePostIconOverride: false, IncomingWebhook: model.IncomingWebhook{ - DisplayName: "title", - Description: "description", - ChannelId: th.BasicChannel.Id, - PostUsername: ":invalid:", + DisplayName: "title", + Description: "description", + ChannelId: th.BasicChannel.Id, + Username: ":invalid:", }, ExpectedError: true, @@ -103,20 +103,20 @@ func TestCreateIncomingWebhookForChannel(t *testing.T) { EnablePostUsernameOverride: true, EnablePostIconOverride: true, IncomingWebhook: model.IncomingWebhook{ - DisplayName: "title", - Description: "description", - ChannelId: th.BasicChannel.Id, - PostUsername: "valid", - PostIconURL: "http://example.com/icon", + DisplayName: "title", + Description: "description", + ChannelId: th.BasicChannel.Id, + Username: "valid", + IconURL: "http://example.com/icon", }, ExpectedError: false, ExpectedIncomingWebhook: &model.IncomingWebhook{ - DisplayName: "title", - Description: "description", - ChannelId: th.BasicChannel.Id, - PostUsername: "valid", - PostIconURL: "http://example.com/icon", + DisplayName: "title", + Description: "description", + ChannelId: th.BasicChannel.Id, + Username: "valid", + IconURL: "http://example.com/icon", }, }, } { @@ -144,8 +144,8 @@ func TestCreateIncomingWebhookForChannel(t *testing.T) { assert.Equal(tc.ExpectedIncomingWebhook.DisplayName, createdHook.DisplayName) assert.Equal(tc.ExpectedIncomingWebhook.Description, createdHook.Description) assert.Equal(tc.ExpectedIncomingWebhook.ChannelId, createdHook.ChannelId) - assert.Equal(tc.ExpectedIncomingWebhook.PostUsername, createdHook.PostUsername) - assert.Equal(tc.ExpectedIncomingWebhook.PostIconURL, createdHook.PostIconURL) + assert.Equal(tc.ExpectedIncomingWebhook.Username, createdHook.Username) + assert.Equal(tc.ExpectedIncomingWebhook.IconURL, createdHook.IconURL) } }) } @@ -191,11 +191,11 @@ func TestUpdateIncomingWebhook(t *testing.T) { EnablePostUsernameOverride: false, EnablePostIconOverride: false, IncomingWebhook: model.IncomingWebhook{ - DisplayName: "title", - Description: "description", - ChannelId: th.BasicChannel.Id, - PostUsername: ":invalid and ignored:", - PostIconURL: "ignored", + DisplayName: "title", + Description: "description", + ChannelId: th.BasicChannel.Id, + Username: ":invalid and ignored:", + IconURL: "ignored", }, ExpectedError: false, @@ -210,10 +210,10 @@ func TestUpdateIncomingWebhook(t *testing.T) { EnablePostUsernameOverride: true, EnablePostIconOverride: false, IncomingWebhook: model.IncomingWebhook{ - DisplayName: "title", - Description: "description", - ChannelId: th.BasicChannel.Id, - PostUsername: ":invalid:", + DisplayName: "title", + Description: "description", + ChannelId: th.BasicChannel.Id, + Username: ":invalid:", }, ExpectedError: true, @@ -241,20 +241,20 @@ func TestUpdateIncomingWebhook(t *testing.T) { EnablePostUsernameOverride: true, EnablePostIconOverride: true, IncomingWebhook: model.IncomingWebhook{ - DisplayName: "title", - Description: "description", - ChannelId: th.BasicChannel.Id, - PostUsername: "valid", - PostIconURL: "http://example.com/icon", + DisplayName: "title", + Description: "description", + ChannelId: th.BasicChannel.Id, + Username: "valid", + IconURL: "http://example.com/icon", }, ExpectedError: false, ExpectedIncomingWebhook: &model.IncomingWebhook{ - DisplayName: "title", - Description: "description", - ChannelId: th.BasicChannel.Id, - PostUsername: "valid", - PostIconURL: "http://example.com/icon", + DisplayName: "title", + Description: "description", + ChannelId: th.BasicChannel.Id, + Username: "valid", + IconURL: "http://example.com/icon", }, }, } { @@ -289,8 +289,8 @@ func TestUpdateIncomingWebhook(t *testing.T) { assert.Equal(tc.ExpectedIncomingWebhook.DisplayName, updatedHook.DisplayName) assert.Equal(tc.ExpectedIncomingWebhook.Description, updatedHook.Description) assert.Equal(tc.ExpectedIncomingWebhook.ChannelId, updatedHook.ChannelId) - assert.Equal(tc.ExpectedIncomingWebhook.PostUsername, updatedHook.PostUsername) - assert.Equal(tc.ExpectedIncomingWebhook.PostIconURL, updatedHook.PostIconURL) + assert.Equal(tc.ExpectedIncomingWebhook.Username, updatedHook.Username) + assert.Equal(tc.ExpectedIncomingWebhook.IconURL, updatedHook.IconURL) } }) } |