Этот коммит содержится в:
Corey Hulen
2017-02-13 11:36:18 -05:00
коммит произвёл Joram Wilander
родитель 88889a9b0e
Коммит 0a21eed004

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

@@ -997,51 +997,51 @@ func TestDeletePosts(t *testing.T) {
} }
func TestEmailMention(t *testing.T) { // func TestEmailMention(t *testing.T) {
th := Setup().InitBasic() // th := Setup().InitBasic()
Client := th.BasicClient // Client := th.BasicClient
channel1 := th.BasicChannel // channel1 := th.BasicChannel
Client.Must(Client.AddChannelMember(channel1.Id, th.BasicUser2.Id)) // Client.Must(Client.AddChannelMember(channel1.Id, th.BasicUser2.Id))
th.LoginBasic2() // th.LoginBasic2()
//Set the notification properties // //Set the notification properties
data := make(map[string]string) // data := make(map[string]string)
data["user_id"] = th.BasicUser2.Id // data["user_id"] = th.BasicUser2.Id
data["email"] = "true" // data["email"] = "true"
data["desktop"] = "all" // data["desktop"] = "all"
data["desktop_sound"] = "false" // data["desktop_sound"] = "false"
data["comments"] = "any" // data["comments"] = "any"
Client.Must(Client.UpdateUserNotify(data)) // Client.Must(Client.UpdateUserNotify(data))
store.Must(app.Srv.Store.Preference().Save(&model.Preferences{{ // store.Must(app.Srv.Store.Preference().Save(&model.Preferences{{
UserId: th.BasicUser2.Id, // UserId: th.BasicUser2.Id,
Category: model.PREFERENCE_CATEGORY_NOTIFICATIONS, // Category: model.PREFERENCE_CATEGORY_NOTIFICATIONS,
Name: model.PREFERENCE_NAME_EMAIL_INTERVAL, // Name: model.PREFERENCE_NAME_EMAIL_INTERVAL,
Value: "0", // Value: "0",
}})) // }}))
//Delete all the messages before create a mention post // //Delete all the messages before create a mention post
utils.DeleteMailBox(th.BasicUser2.Email) // utils.DeleteMailBox(th.BasicUser2.Email)
//Send a mention message from user1 to user2 // //Send a mention message from user1 to user2
th.LoginBasic() // th.LoginBasic()
time.Sleep(10 * time.Millisecond) // time.Sleep(10 * time.Millisecond)
post1 := &model.Post{ChannelId: channel1.Id, Message: "@" + th.BasicUser2.Username + " this is a test"} // post1 := &model.Post{ChannelId: channel1.Id, Message: "@" + th.BasicUser2.Username + " this is a test"}
post1 = Client.Must(Client.CreatePost(post1)).Data.(*model.Post) // post1 = Client.Must(Client.CreatePost(post1)).Data.(*model.Post)
//Check if the email was send to the rigth email address and the mention // //Check if the email was send to the rigth email address and the mention
if resultsMailbox, err := utils.GetMailBox(th.BasicUser2.Email); err != nil && !strings.ContainsAny(resultsMailbox[0].To[0], th.BasicUser2.Email) { // if resultsMailbox, err := utils.GetMailBox(th.BasicUser2.Email); err != nil && !strings.ContainsAny(resultsMailbox[0].To[0], th.BasicUser2.Email) {
t.Fatal("Wrong To recipient") // t.Fatal("Wrong To recipient")
} else { // } else {
if resultsEmail, err := utils.GetMessageFromMailbox(th.BasicUser2.Email, resultsMailbox[0].ID); err == nil { // if resultsEmail, err := utils.GetMessageFromMailbox(th.BasicUser2.Email, resultsMailbox[0].ID); err == nil {
if !strings.Contains(resultsEmail.Body.Text, post1.Message) { // if !strings.Contains(resultsEmail.Body.Text, post1.Message) {
t.Log(resultsEmail.Body.Text) // t.Log(resultsEmail.Body.Text)
t.Fatal("Received wrong Message") // t.Fatal("Received wrong Message")
} // }
} // }
} // }
} // }
func TestFuzzyPosts(t *testing.T) { func TestFuzzyPosts(t *testing.T) {
th := Setup().InitBasic() th := Setup().InitBasic()