-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[MI-3201] Fix issue 171 of punctuation marks not working from MM to T…
…eams (#200) * [MI-3201] Fix issue 171 of punctuation marks not working from MM to Teams * [MI-3201] Fix issue in DMs and GMs * [MI-3201] Update test cases to include puntuation in messages
- Loading branch information
1 parent
29a8be7
commit fd25cbc
Showing
2 changed files
with
28 additions
and
28 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -1051,7 +1051,7 @@ func TestSendChat(t *testing.T) { | |
uclient.On("UploadFile", "", "", "mockFile.Name"+"_"+testutils.GetID()+".txt", 1, "mockMimeType", bytes.NewReader([]byte("mockData"))).Return(&msteams.Attachment{ | ||
ID: testutils.GetID(), | ||
}, nil).Times(1) | ||
uclient.On("SendChat", "mockChatID", "<p>mockMessage</p>\n", (*msteams.Message)(nil), []*msteams.Attachment{{ | ||
uclient.On("SendChat", "mockChatID", "<p>mockMessage??????????</p>\n", (*msteams.Message)(nil), []*msteams.Attachment{{ | ||
ID: testutils.GetID(), | ||
}}, []models.ChatMessageMentionable{}).Return(nil, errors.New("unable to send the chat")).Times(1) | ||
}, | ||
|
@@ -1076,7 +1076,7 @@ func TestSendChat(t *testing.T) { | |
}, | ||
SetupClient: func(client *clientmocks.Client, uclient *clientmocks.Client) { | ||
uclient.On("CreateOrGetChatForUsers", mock.Anything).Return("mockChatID", nil).Times(1) | ||
uclient.On("SendChat", "mockChatID", "<p>mockMessage</p>\n", (*msteams.Message)(nil), []*msteams.Attachment{{ | ||
uclient.On("SendChat", "mockChatID", "<p>mockMessage??????????</p>\n", (*msteams.Message)(nil), []*msteams.Attachment{{ | ||
ID: testutils.GetID(), | ||
}}, []models.ChatMessageMentionable{}).Return(&msteams.Message{ | ||
ID: "mockMessageID", | ||
|
@@ -1108,7 +1108,7 @@ func TestSendChat(t *testing.T) { | |
}, | ||
SetupClient: func(client *clientmocks.Client, uclient *clientmocks.Client) { | ||
uclient.On("CreateOrGetChatForUsers", mock.Anything).Return("mockChatID", nil).Once() | ||
uclient.On("SendChat", "mockChatID", "<p>mockMessage</p>\n", (*msteams.Message)(nil), []*msteams.Attachment{{ | ||
uclient.On("SendChat", "mockChatID", "<p>mockMessage??????????</p>\n", (*msteams.Message)(nil), []*msteams.Attachment{{ | ||
ID: testutils.GetID(), | ||
}}, []models.ChatMessageMentionable{}).Return(&msteams.Message{ | ||
ID: "mockMessageID", | ||
|
@@ -1138,7 +1138,7 @@ func TestSendChat(t *testing.T) { | |
}, | ||
SetupClient: func(client *clientmocks.Client, uclient *clientmocks.Client) { | ||
uclient.On("CreateOrGetChatForUsers", mock.Anything).Return("mockChatID", nil).Times(1) | ||
uclient.On("SendChat", "mockChatID", "<p>mockMessage</p>\n", (*msteams.Message)(nil), ([]*msteams.Attachment)(nil), []models.ChatMessageMentionable{}).Return(&msteams.Message{ | ||
uclient.On("SendChat", "mockChatID", "<p>mockMessage??????????</p>\n", (*msteams.Message)(nil), ([]*msteams.Attachment)(nil), []models.ChatMessageMentionable{}).Return(&msteams.Message{ | ||
ID: "mockMessageID", | ||
}, nil).Times(1) | ||
}, | ||
|
@@ -1163,7 +1163,7 @@ func TestSendChat(t *testing.T) { | |
}, | ||
SetupClient: func(client *clientmocks.Client, uclient *clientmocks.Client) { | ||
uclient.On("CreateOrGetChatForUsers", mock.Anything).Return("mockChatID", nil).Times(1) | ||
uclient.On("SendChat", "mockChatID", "<p>mockMessage</p>\n", (*msteams.Message)(nil), ([]*msteams.Attachment)(nil), []models.ChatMessageMentionable{}).Return(&msteams.Message{ | ||
uclient.On("SendChat", "mockChatID", "<p>mockMessage??????????</p>\n", (*msteams.Message)(nil), ([]*msteams.Attachment)(nil), []models.ChatMessageMentionable{}).Return(&msteams.Message{ | ||
ID: "mockMessageID", | ||
}, nil).Times(1) | ||
}, | ||
|
@@ -1197,7 +1197,7 @@ func TestSendChat(t *testing.T) { | |
Text: "mockText", | ||
UserDisplayName: "mockUserDisplayName", | ||
}, nil).Once() | ||
uclient.On("SendChat", "mockChatID", "<p>mockMessage</p>\n", &msteams.Message{ | ||
uclient.On("SendChat", "mockChatID", "<p>mockMessage??????????</p>\n", &msteams.Message{ | ||
ID: "mockParentMessageID", | ||
UserID: "mockUserID", | ||
Text: "mockText", | ||
|
@@ -1229,7 +1229,7 @@ func TestSendChat(t *testing.T) { | |
uclient.On("UploadFile", "", "", "mockFile.Name"+"_"+testutils.GetID()+".txt", 1, "mockMimeType", bytes.NewReader([]byte("mockData"))).Return(&msteams.Attachment{ | ||
ID: testutils.GetID(), | ||
}, nil).Times(1) | ||
uclient.On("SendChat", "mockChatID", "<p>mockMessage</p>\n", (*msteams.Message)(nil), []*msteams.Attachment{{ | ||
uclient.On("SendChat", "mockChatID", "<p>mockMessage??????????</p>\n", (*msteams.Message)(nil), []*msteams.Attachment{{ | ||
ID: testutils.GetID(), | ||
}}, []models.ChatMessageMentionable{}).Return(&msteams.Message{ | ||
ID: "mockMessageID", | ||
|
@@ -1245,7 +1245,7 @@ func TestSendChat(t *testing.T) { | |
test.SetupStore(p.store.(*storemocks.Store)) | ||
test.SetupClient(p.msteamsAppClient.(*clientmocks.Client), p.clientBuilderWithToken("", "", "", "", nil, nil).(*clientmocks.Client)) | ||
mockPost := testutils.GetPost(testutils.GetChannelID(), testutils.GetUserID()) | ||
mockPost.Message = "mockMessage" | ||
mockPost.Message = "mockMessage??????????" | ||
mockPost.RootId = "mockRootID" | ||
resp, err := p.SendChat(testutils.GetID(), []string{testutils.GetID(), testutils.GetID()}, mockPost) | ||
if test.ExpectedError != "" { | ||
|
@@ -1293,7 +1293,7 @@ func TestSend(t *testing.T) { | |
}).Return(nil).Times(1) | ||
}, | ||
SetupClient: func(client *clientmocks.Client, uclient *clientmocks.Client) { | ||
uclient.On("SendMessageWithAttachments", testutils.GetID(), testutils.GetChannelID(), "", "<p>mockMessage</p>\n", ([]*msteams.Attachment)(nil), []models.ChatMessageMentionable{}).Return(&msteams.Message{ | ||
uclient.On("SendMessageWithAttachments", testutils.GetID(), testutils.GetChannelID(), "", "<p>mockMessage??????????</p>\n", ([]*msteams.Attachment)(nil), []models.ChatMessageMentionable{}).Return(&msteams.Message{ | ||
ID: "mockMessageID", | ||
}, nil).Times(1) | ||
}, | ||
|
@@ -1315,7 +1315,7 @@ func TestSend(t *testing.T) { | |
}).Return(nil).Times(1) | ||
}, | ||
SetupClient: func(client *clientmocks.Client, uclient *clientmocks.Client) { | ||
uclient.On("SendMessageWithAttachments", testutils.GetID(), testutils.GetChannelID(), "", "<p>mockMessage</p>\n", ([]*msteams.Attachment)(nil), []models.ChatMessageMentionable{}).Return(&msteams.Message{ | ||
uclient.On("SendMessageWithAttachments", testutils.GetID(), testutils.GetChannelID(), "", "<p>mockMessage??????????</p>\n", ([]*msteams.Attachment)(nil), []models.ChatMessageMentionable{}).Return(&msteams.Message{ | ||
ID: "mockMessageID", | ||
}, nil).Times(1) | ||
}, | ||
|
@@ -1335,7 +1335,7 @@ func TestSend(t *testing.T) { | |
uclient.On("UploadFile", testutils.GetID(), testutils.GetChannelID(), "mockFile.Name"+"_"+testutils.GetID()+".txt", 1, "mockMimeType", bytes.NewReader([]byte("mockData"))).Return(&msteams.Attachment{ | ||
ID: testutils.GetID(), | ||
}, nil).Times(1) | ||
uclient.On("SendMessageWithAttachments", testutils.GetID(), testutils.GetChannelID(), "", "<p>mockMessage</p>\n", []*msteams.Attachment{ | ||
uclient.On("SendMessageWithAttachments", testutils.GetID(), testutils.GetChannelID(), "", "<p>mockMessage??????????</p>\n", []*msteams.Attachment{ | ||
{ | ||
ID: testutils.GetID(), | ||
}, | ||
|
@@ -1362,7 +1362,7 @@ func TestSend(t *testing.T) { | |
uclient.On("UploadFile", testutils.GetID(), testutils.GetChannelID(), "mockFile.Name"+"_"+testutils.GetID()+".txt", 1, "mockMimeType", bytes.NewReader([]byte("mockData"))).Return(&msteams.Attachment{ | ||
ID: testutils.GetID(), | ||
}, nil).Times(1) | ||
uclient.On("SendMessageWithAttachments", testutils.GetID(), testutils.GetChannelID(), "", "<p>mockMessage</p>\n", []*msteams.Attachment{ | ||
uclient.On("SendMessageWithAttachments", testutils.GetID(), testutils.GetChannelID(), "", "<p>mockMessage??????????</p>\n", []*msteams.Attachment{ | ||
{ | ||
ID: testutils.GetID(), | ||
}, | ||
|
@@ -1390,7 +1390,7 @@ func TestSend(t *testing.T) { | |
uclient.On("UploadFile", testutils.GetID(), testutils.GetChannelID(), "mockFile.Name"+"_"+testutils.GetID()+".txt", 1, "mockMimeType", bytes.NewReader([]byte("mockData"))).Return(&msteams.Attachment{ | ||
ID: testutils.GetID(), | ||
}, nil).Times(1) | ||
uclient.On("SendMessageWithAttachments", testutils.GetID(), testutils.GetChannelID(), "", "<p>mockMessage</p>\n", []*msteams.Attachment{ | ||
uclient.On("SendMessageWithAttachments", testutils.GetID(), testutils.GetChannelID(), "", "<p>mockMessage??????????</p>\n", []*msteams.Attachment{ | ||
{ | ||
ID: testutils.GetID(), | ||
}, | ||
|
@@ -1408,7 +1408,7 @@ func TestSend(t *testing.T) { | |
test.SetupStore(p.store.(*storemocks.Store)) | ||
test.SetupClient(p.msteamsAppClient.(*clientmocks.Client), p.clientBuilderWithToken("", "", "", "", nil, nil).(*clientmocks.Client)) | ||
mockPost := testutils.GetPost(testutils.GetChannelID(), testutils.GetUserID()) | ||
mockPost.Message = "mockMessage" | ||
mockPost.Message = "mockMessage??????????" | ||
resp, err := p.Send(testutils.GetID(), testutils.GetChannelID(), testutils.GetUser(model.SystemAdminRoleId, "[email protected]"), mockPost) | ||
if test.ExpectedError != "" { | ||
assert.Contains(err.Error(), test.ExpectedError) | ||
|
@@ -1659,7 +1659,7 @@ func TestUpdate(t *testing.T) { | |
}, nil).Times(1) | ||
}, | ||
SetupClient: func(client *clientmocks.Client, uclient *clientmocks.Client) { | ||
uclient.On("UpdateMessage", "mockTeamsTeamID", testutils.GetChannelID(), "", "mockMSTeamsID", "<p>mockMessage</p>\n", []models.ChatMessageMentionable{}).Return(errors.New("unable to update the message")).Times(1) | ||
uclient.On("UpdateMessage", "mockTeamsTeamID", testutils.GetChannelID(), "", "mockMSTeamsID", "<p>mockMessage??????????</p>\n", []models.ChatMessageMentionable{}).Return(errors.New("unable to update the message")).Times(1) | ||
}, | ||
ExpectedError: "unable to update the message", | ||
}, | ||
|
@@ -1676,7 +1676,7 @@ func TestUpdate(t *testing.T) { | |
}, nil).Times(1) | ||
}, | ||
SetupClient: func(client *clientmocks.Client, uclient *clientmocks.Client) { | ||
uclient.On("UpdateMessage", "mockTeamsTeamID", testutils.GetChannelID(), "", "mockMSTeamsID", "<p>mockMessage</p>\n", []models.ChatMessageMentionable{}).Return(nil).Times(1) | ||
uclient.On("UpdateMessage", "mockTeamsTeamID", testutils.GetChannelID(), "", "mockMSTeamsID", "<p>mockMessage??????????</p>\n", []models.ChatMessageMentionable{}).Return(nil).Times(1) | ||
uclient.On("GetMessage", "mockTeamsTeamID", testutils.GetChannelID(), "mockMSTeamsID").Return(nil, errors.New("unable to get the updated message")).Times(1) | ||
}, | ||
}, | ||
|
@@ -1698,7 +1698,7 @@ func TestUpdate(t *testing.T) { | |
}).Return(errors.New("unable to store the link posts")).Times(1) | ||
}, | ||
SetupClient: func(client *clientmocks.Client, uclient *clientmocks.Client) { | ||
uclient.On("UpdateMessage", "mockTeamsTeamID", testutils.GetChannelID(), "", "mockMSTeamsID", "<p>mockMessage</p>\n", []models.ChatMessageMentionable{}).Return(nil).Times(1) | ||
uclient.On("UpdateMessage", "mockTeamsTeamID", testutils.GetChannelID(), "", "mockMSTeamsID", "<p>mockMessage??????????</p>\n", []models.ChatMessageMentionable{}).Return(nil).Times(1) | ||
uclient.On("GetMessage", "mockTeamsTeamID", testutils.GetChannelID(), "mockMSTeamsID").Return(&msteams.Message{ | ||
ID: testutils.GetID(), | ||
}, nil).Times(1) | ||
|
@@ -1722,7 +1722,7 @@ func TestUpdate(t *testing.T) { | |
}).Return(nil).Times(1) | ||
}, | ||
SetupClient: func(client *clientmocks.Client, uclient *clientmocks.Client) { | ||
uclient.On("UpdateMessage", "mockTeamsTeamID", testutils.GetChannelID(), "", "mockMSTeamsID", "<p>mockMessage</p>\n", []models.ChatMessageMentionable{}).Return(nil).Times(1) | ||
uclient.On("UpdateMessage", "mockTeamsTeamID", testutils.GetChannelID(), "", "mockMSTeamsID", "<p>mockMessage??????????</p>\n", []models.ChatMessageMentionable{}).Return(nil).Times(1) | ||
uclient.On("GetMessage", "mockTeamsTeamID", testutils.GetChannelID(), "mockMSTeamsID").Return(&msteams.Message{ | ||
ID: testutils.GetID(), | ||
}, nil).Times(1) | ||
|
@@ -1736,7 +1736,7 @@ func TestUpdate(t *testing.T) { | |
test.SetupStore(p.store.(*storemocks.Store)) | ||
test.SetupClient(p.msteamsAppClient.(*clientmocks.Client), p.clientBuilderWithToken("", "", "", "", nil, nil).(*clientmocks.Client)) | ||
mockPost := testutils.GetPost(testutils.GetChannelID(), testutils.GetUserID()) | ||
mockPost.Message = "mockMessage" | ||
mockPost.Message = "mockMessage??????????" | ||
err := p.Update("mockTeamsTeamID", testutils.GetChannelID(), testutils.GetUser(model.ChannelAdminRoleId, "[email protected]"), mockPost, testutils.GetPost(testutils.GetChannelID(), testutils.GetUserID())) | ||
if test.ExpectedError != "" { | ||
assert.Contains(err.Error(), test.ExpectedError) | ||
|
@@ -1805,7 +1805,7 @@ func TestUpdateChat(t *testing.T) { | |
}, nil).Times(1) | ||
}, | ||
SetupClient: func(client *clientmocks.Client, uclient *clientmocks.Client) { | ||
uclient.On("UpdateChatMessage", "mockChatID", "mockTeamsTeamID", "<p>mockMessage</p>\n", []models.ChatMessageMentionable{}).Return(errors.New("unable to update the message")).Times(1) | ||
uclient.On("UpdateChatMessage", "mockChatID", "mockTeamsTeamID", "<p>mockMessage??????????</p>\n", []models.ChatMessageMentionable{}).Return(errors.New("unable to update the message")).Times(1) | ||
}, | ||
ExpectedError: "unable to update the message", | ||
}, | ||
|
@@ -1822,7 +1822,7 @@ func TestUpdateChat(t *testing.T) { | |
}, nil).Times(1) | ||
}, | ||
SetupClient: func(client *clientmocks.Client, uclient *clientmocks.Client) { | ||
uclient.On("UpdateChatMessage", "mockChatID", "mockTeamsTeamID", "<p>mockMessage</p>\n", []models.ChatMessageMentionable{}).Return(nil).Times(1) | ||
uclient.On("UpdateChatMessage", "mockChatID", "mockTeamsTeamID", "<p>mockMessage??????????</p>\n", []models.ChatMessageMentionable{}).Return(nil).Times(1) | ||
uclient.On("GetChatMessage", "mockChatID", "mockTeamsTeamID").Return(nil, errors.New("unable to get the updated message")).Times(1) | ||
}, | ||
}, | ||
|
@@ -1844,7 +1844,7 @@ func TestUpdateChat(t *testing.T) { | |
}).Return(errors.New("unable to store the link posts")).Times(1) | ||
}, | ||
SetupClient: func(client *clientmocks.Client, uclient *clientmocks.Client) { | ||
uclient.On("UpdateChatMessage", "mockChatID", "mockTeamsTeamID", "<p>mockMessage</p>\n", []models.ChatMessageMentionable{}).Return(nil).Times(1) | ||
uclient.On("UpdateChatMessage", "mockChatID", "mockTeamsTeamID", "<p>mockMessage??????????</p>\n", []models.ChatMessageMentionable{}).Return(nil).Times(1) | ||
uclient.On("GetChatMessage", "mockChatID", "mockTeamsTeamID").Return(&msteams.Message{ | ||
ID: testutils.GetID(), | ||
}, nil).Times(1) | ||
|
@@ -1868,7 +1868,7 @@ func TestUpdateChat(t *testing.T) { | |
}).Return(nil).Times(1) | ||
}, | ||
SetupClient: func(client *clientmocks.Client, uclient *clientmocks.Client) { | ||
uclient.On("UpdateChatMessage", "mockChatID", "mockTeamsTeamID", "<p>mockMessage</p>\n", []models.ChatMessageMentionable{}).Return(nil).Times(1) | ||
uclient.On("UpdateChatMessage", "mockChatID", "mockTeamsTeamID", "<p>mockMessage??????????</p>\n", []models.ChatMessageMentionable{}).Return(nil).Times(1) | ||
uclient.On("GetChatMessage", "mockChatID", "mockTeamsTeamID").Return(&msteams.Message{ | ||
ID: testutils.GetID(), | ||
}, nil).Times(1) | ||
|
@@ -1882,7 +1882,7 @@ func TestUpdateChat(t *testing.T) { | |
test.SetupStore(p.store.(*storemocks.Store)) | ||
test.SetupClient(p.msteamsAppClient.(*clientmocks.Client), p.clientBuilderWithToken("", "", "", "", nil, nil).(*clientmocks.Client)) | ||
mockPost := testutils.GetPost(testutils.GetChannelID(), testutils.GetUserID()) | ||
mockPost.Message = "mockMessage" | ||
mockPost.Message = "mockMessage??????????" | ||
err := p.UpdateChat("mockChatID", testutils.GetUser(model.ChannelAdminRoleId, "[email protected]"), mockPost, testutils.GetPost(testutils.GetChannelID(), testutils.GetUserID())) | ||
if test.ExpectedError != "" { | ||
assert.Contains(err.Error(), test.ExpectedError) | ||
|