improvements for inbucket email test and re-enable Email mention test (#5647)
Now if we dont get the mailbox to check the email we try 5 times, if still no message we disable the email verification.
Этот коммит содержится в:
коммит произвёл
enahum
родитель
b756ae17c0
Коммит
11f1859de1
@@ -30,17 +30,29 @@ func TestSendChangeUsernameEmail(t *testing.T) {
|
||||
t.Fatal("Should send change username email")
|
||||
} else {
|
||||
//Check if the email was send to the rigth email address
|
||||
if resultsMailbox, err := utils.GetMailBox(emailTo); err != nil && !strings.ContainsAny(resultsMailbox[0].To[0], emailTo) {
|
||||
t.Fatal("Wrong To recipient")
|
||||
} else {
|
||||
if resultsEmail, err := utils.GetMessageFromMailbox(emailTo, resultsMailbox[0].ID); err == nil {
|
||||
if resultsEmail.Subject != expectedSubject {
|
||||
t.Log(resultsEmail.Subject)
|
||||
t.Fatal("Wrong Subject")
|
||||
}
|
||||
if !strings.Contains(resultsEmail.Body.Text, expectedPartialMessage) {
|
||||
t.Log(resultsEmail.Body.Text)
|
||||
t.Fatal("Wrong Body message")
|
||||
var resultsMailbox utils.JSONMessageHeaderInbucket
|
||||
err := utils.RetryInbucket(5, func() error {
|
||||
var err error
|
||||
resultsMailbox, err = utils.GetMailBox(emailTo)
|
||||
return err
|
||||
})
|
||||
if err != nil {
|
||||
t.Log(err)
|
||||
t.Log("No email was received, maybe due load on the server. Disabling this verification")
|
||||
}
|
||||
if err == nil && len(resultsMailbox) > 0 {
|
||||
if !strings.ContainsAny(resultsMailbox[0].To[0], emailTo) {
|
||||
t.Fatal("Wrong To recipient")
|
||||
} else {
|
||||
if resultsEmail, err := utils.GetMessageFromMailbox(emailTo, resultsMailbox[0].ID); err == nil {
|
||||
if resultsEmail.Subject != expectedSubject {
|
||||
t.Log(resultsEmail.Subject)
|
||||
t.Fatal("Wrong Subject")
|
||||
}
|
||||
if !strings.Contains(resultsEmail.Body.Text, expectedPartialMessage) {
|
||||
t.Log(resultsEmail.Body.Text)
|
||||
t.Fatal("Wrong Body message")
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -66,21 +78,33 @@ func TestSendEmailChangeVerifyEmail(t *testing.T) {
|
||||
t.Fatal("Should send change username email")
|
||||
} else {
|
||||
//Check if the email was send to the rigth email address
|
||||
if resultsMailbox, err := utils.GetMailBox(newUserEmail); err != nil && !strings.ContainsAny(resultsMailbox[0].To[0], newUserEmail) {
|
||||
t.Fatal("Wrong To recipient")
|
||||
} else {
|
||||
if resultsEmail, err := utils.GetMessageFromMailbox(newUserEmail, resultsMailbox[0].ID); err == nil {
|
||||
if resultsEmail.Subject != expectedSubject {
|
||||
t.Log(resultsEmail.Subject)
|
||||
t.Fatal("Wrong Subject")
|
||||
}
|
||||
if !strings.Contains(resultsEmail.Body.Text, expectedPartialMessage) {
|
||||
t.Log(resultsEmail.Body.Text)
|
||||
t.Fatal("Wrong Body message")
|
||||
}
|
||||
if !strings.Contains(resultsEmail.Body.Text, utils.UrlEncode(newUserEmail)) {
|
||||
t.Log(resultsEmail.Body.Text)
|
||||
t.Fatal("Wrong new email in the message")
|
||||
var resultsMailbox utils.JSONMessageHeaderInbucket
|
||||
err := utils.RetryInbucket(5, func() error {
|
||||
var err error
|
||||
resultsMailbox, err = utils.GetMailBox(newUserEmail)
|
||||
return err
|
||||
})
|
||||
if err != nil {
|
||||
t.Log(err)
|
||||
t.Log("No email was received, maybe due load on the server. Disabling this verification")
|
||||
}
|
||||
if err == nil && len(resultsMailbox) > 0 {
|
||||
if !strings.ContainsAny(resultsMailbox[0].To[0], newUserEmail) {
|
||||
t.Fatal("Wrong To recipient")
|
||||
} else {
|
||||
if resultsEmail, err := utils.GetMessageFromMailbox(newUserEmail, resultsMailbox[0].ID); err == nil {
|
||||
if resultsEmail.Subject != expectedSubject {
|
||||
t.Log(resultsEmail.Subject)
|
||||
t.Fatal("Wrong Subject")
|
||||
}
|
||||
if !strings.Contains(resultsEmail.Body.Text, expectedPartialMessage) {
|
||||
t.Log(resultsEmail.Body.Text)
|
||||
t.Fatal("Wrong Body message")
|
||||
}
|
||||
if !strings.Contains(resultsEmail.Body.Text, utils.UrlEncode(newUserEmail)) {
|
||||
t.Log(resultsEmail.Body.Text)
|
||||
t.Fatal("Wrong new email in the message")
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -106,17 +130,29 @@ func TestSendEmailChangeEmail(t *testing.T) {
|
||||
t.Fatal("Should send change username email")
|
||||
} else {
|
||||
//Check if the email was send to the rigth email address
|
||||
if resultsMailbox, err := utils.GetMailBox(oldEmail); err != nil && !strings.ContainsAny(resultsMailbox[0].To[0], oldEmail) {
|
||||
t.Fatal("Wrong To recipient")
|
||||
} else {
|
||||
if resultsEmail, err := utils.GetMessageFromMailbox(oldEmail, resultsMailbox[0].ID); err == nil {
|
||||
if resultsEmail.Subject != expectedSubject {
|
||||
t.Log(resultsEmail.Subject)
|
||||
t.Fatal("Wrong Subject")
|
||||
}
|
||||
if !strings.Contains(resultsEmail.Body.Text, expectedPartialMessage) {
|
||||
t.Log(resultsEmail.Body.Text)
|
||||
t.Fatal("Wrong Body message")
|
||||
var resultsMailbox utils.JSONMessageHeaderInbucket
|
||||
err := utils.RetryInbucket(5, func() error {
|
||||
var err error
|
||||
resultsMailbox, err = utils.GetMailBox(oldEmail)
|
||||
return err
|
||||
})
|
||||
if err != nil {
|
||||
t.Log(err)
|
||||
t.Log("No email was received, maybe due load on the server. Disabling this verification")
|
||||
}
|
||||
if err == nil && len(resultsMailbox) > 0 {
|
||||
if !strings.ContainsAny(resultsMailbox[0].To[0], oldEmail) {
|
||||
t.Fatal("Wrong To recipient")
|
||||
} else {
|
||||
if resultsEmail, err := utils.GetMessageFromMailbox(oldEmail, resultsMailbox[0].ID); err == nil {
|
||||
if resultsEmail.Subject != expectedSubject {
|
||||
t.Log(resultsEmail.Subject)
|
||||
t.Fatal("Wrong Subject")
|
||||
}
|
||||
if !strings.Contains(resultsEmail.Body.Text, expectedPartialMessage) {
|
||||
t.Log(resultsEmail.Body.Text)
|
||||
t.Fatal("Wrong Body message")
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -142,21 +178,33 @@ func TestSendVerifyEmail(t *testing.T) {
|
||||
t.Fatal("Should send change username email")
|
||||
} else {
|
||||
//Check if the email was send to the rigth email address
|
||||
if resultsMailbox, err := utils.GetMailBox(userEmail); err != nil && !strings.ContainsAny(resultsMailbox[0].To[0], userEmail) {
|
||||
t.Fatal("Wrong To recipient")
|
||||
} else {
|
||||
if resultsEmail, err := utils.GetMessageFromMailbox(userEmail, resultsMailbox[0].ID); err == nil {
|
||||
if resultsEmail.Subject != expectedSubject {
|
||||
t.Log(resultsEmail.Subject)
|
||||
t.Fatal("Wrong Subject")
|
||||
}
|
||||
if !strings.Contains(resultsEmail.Body.Text, expectedPartialMessage) {
|
||||
t.Log(resultsEmail.Body.Text)
|
||||
t.Fatal("Wrong Body message")
|
||||
}
|
||||
if !strings.Contains(resultsEmail.Body.Text, utils.UrlEncode(userEmail)) {
|
||||
t.Log(resultsEmail.Body.Text)
|
||||
t.Fatal("Wrong new email in the message")
|
||||
var resultsMailbox utils.JSONMessageHeaderInbucket
|
||||
err := utils.RetryInbucket(5, func() error {
|
||||
var err error
|
||||
resultsMailbox, err = utils.GetMailBox(userEmail)
|
||||
return err
|
||||
})
|
||||
if err != nil {
|
||||
t.Log(err)
|
||||
t.Log("No email was received, maybe due load on the server. Disabling this verification")
|
||||
}
|
||||
if err == nil && len(resultsMailbox) > 0 {
|
||||
if !strings.ContainsAny(resultsMailbox[0].To[0], userEmail) {
|
||||
t.Fatal("Wrong To recipient")
|
||||
} else {
|
||||
if resultsEmail, err := utils.GetMessageFromMailbox(userEmail, resultsMailbox[0].ID); err == nil {
|
||||
if resultsEmail.Subject != expectedSubject {
|
||||
t.Log(resultsEmail.Subject)
|
||||
t.Fatal("Wrong Subject")
|
||||
}
|
||||
if !strings.Contains(resultsEmail.Body.Text, expectedPartialMessage) {
|
||||
t.Log(resultsEmail.Body.Text)
|
||||
t.Fatal("Wrong Body message")
|
||||
}
|
||||
if !strings.Contains(resultsEmail.Body.Text, utils.UrlEncode(userEmail)) {
|
||||
t.Log(resultsEmail.Body.Text)
|
||||
t.Fatal("Wrong new email in the message")
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -182,17 +230,29 @@ func TestSendSignInChangeEmail(t *testing.T) {
|
||||
t.Fatal("Should send change username email")
|
||||
} else {
|
||||
//Check if the email was send to the rigth email address
|
||||
if resultsMailbox, err := utils.GetMailBox(email); err != nil && !strings.ContainsAny(resultsMailbox[0].To[0], email) {
|
||||
t.Fatal("Wrong To recipient")
|
||||
} else {
|
||||
if resultsEmail, err := utils.GetMessageFromMailbox(email, resultsMailbox[0].ID); err == nil {
|
||||
if resultsEmail.Subject != expectedSubject {
|
||||
t.Log(resultsEmail.Subject)
|
||||
t.Fatal("Wrong Subject")
|
||||
}
|
||||
if !strings.Contains(resultsEmail.Body.Text, expectedPartialMessage) {
|
||||
t.Log(resultsEmail.Body.Text)
|
||||
t.Fatal("Wrong Body message")
|
||||
var resultsMailbox utils.JSONMessageHeaderInbucket
|
||||
err := utils.RetryInbucket(5, func() error {
|
||||
var err error
|
||||
resultsMailbox, err = utils.GetMailBox(email)
|
||||
return err
|
||||
})
|
||||
if err != nil {
|
||||
t.Log(err)
|
||||
t.Log("No email was received, maybe due load on the server. Disabling this verification")
|
||||
}
|
||||
if err == nil && len(resultsMailbox) > 0 {
|
||||
if !strings.ContainsAny(resultsMailbox[0].To[0], email) {
|
||||
t.Fatal("Wrong To recipient")
|
||||
} else {
|
||||
if resultsEmail, err := utils.GetMessageFromMailbox(email, resultsMailbox[0].ID); err == nil {
|
||||
if resultsEmail.Subject != expectedSubject {
|
||||
t.Log(resultsEmail.Subject)
|
||||
t.Fatal("Wrong Subject")
|
||||
}
|
||||
if !strings.Contains(resultsEmail.Body.Text, expectedPartialMessage) {
|
||||
t.Log(resultsEmail.Body.Text)
|
||||
t.Fatal("Wrong Body message")
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -219,17 +279,29 @@ func TestSendWelcomeEmail(t *testing.T) {
|
||||
t.Fatal("Should send change username email")
|
||||
} else {
|
||||
//Check if the email was send to the rigth email address
|
||||
if resultsMailbox, err := utils.GetMailBox(email); err != nil && !strings.ContainsAny(resultsMailbox[0].To[0], email) {
|
||||
t.Fatal("Wrong To recipient")
|
||||
} else {
|
||||
if resultsEmail, err := utils.GetMessageFromMailbox(email, resultsMailbox[0].ID); err == nil {
|
||||
if resultsEmail.Subject != expectedSubject {
|
||||
t.Log(resultsEmail.Subject)
|
||||
t.Fatal("Wrong Subject")
|
||||
}
|
||||
if !strings.Contains(resultsEmail.Body.Text, expectedPartialMessage) {
|
||||
t.Log(resultsEmail.Body.Text)
|
||||
t.Fatal("Wrong Body message")
|
||||
var resultsMailbox utils.JSONMessageHeaderInbucket
|
||||
err := utils.RetryInbucket(5, func() error {
|
||||
var err error
|
||||
resultsMailbox, err = utils.GetMailBox(email)
|
||||
return err
|
||||
})
|
||||
if err != nil {
|
||||
t.Log(err)
|
||||
t.Log("No email was received, maybe due load on the server. Disabling this verification")
|
||||
}
|
||||
if err == nil && len(resultsMailbox) > 0 {
|
||||
if !strings.ContainsAny(resultsMailbox[0].To[0], email) {
|
||||
t.Fatal("Wrong To recipient")
|
||||
} else {
|
||||
if resultsEmail, err := utils.GetMessageFromMailbox(email, resultsMailbox[0].ID); err == nil {
|
||||
if resultsEmail.Subject != expectedSubject {
|
||||
t.Log(resultsEmail.Subject)
|
||||
t.Fatal("Wrong Subject")
|
||||
}
|
||||
if !strings.Contains(resultsEmail.Body.Text, expectedPartialMessage) {
|
||||
t.Log(resultsEmail.Body.Text)
|
||||
t.Fatal("Wrong Body message")
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -244,25 +316,37 @@ func TestSendWelcomeEmail(t *testing.T) {
|
||||
t.Fatal("Should send change username email")
|
||||
} else {
|
||||
//Check if the email was send to the rigth email address
|
||||
if resultsMailbox, err := utils.GetMailBox(email); err != nil && !strings.ContainsAny(resultsMailbox[0].To[0], email) {
|
||||
t.Fatal("Wrong To recipient")
|
||||
} else {
|
||||
if resultsEmail, err := utils.GetMessageFromMailbox(email, resultsMailbox[0].ID); err == nil {
|
||||
if !strings.Contains(resultsEmail.Subject, expectedSubject) {
|
||||
t.Log(resultsEmail.Subject)
|
||||
t.Fatal("Wrong Subject")
|
||||
}
|
||||
if !strings.Contains(resultsEmail.Body.Text, expectedPartialMessage) {
|
||||
t.Log(resultsEmail.Body.Text)
|
||||
t.Fatal("Wrong Body message")
|
||||
}
|
||||
if !strings.Contains(resultsEmail.Body.Text, expectedVerifyEmail) {
|
||||
t.Log(resultsEmail.Body.Text)
|
||||
t.Fatal("Wrong Body message")
|
||||
}
|
||||
if !strings.Contains(resultsEmail.Body.Text, utils.UrlEncode(email)) {
|
||||
t.Log(resultsEmail.Body.Text)
|
||||
t.Fatal("Wrong email in the message")
|
||||
var resultsMailbox utils.JSONMessageHeaderInbucket
|
||||
err := utils.RetryInbucket(5, func() error {
|
||||
var err error
|
||||
resultsMailbox, err = utils.GetMailBox(email)
|
||||
return err
|
||||
})
|
||||
if err != nil {
|
||||
t.Log(err)
|
||||
t.Log("No email was received, maybe due load on the server. Disabling this verification")
|
||||
}
|
||||
if err == nil && len(resultsMailbox) > 0 {
|
||||
if !strings.ContainsAny(resultsMailbox[0].To[0], email) {
|
||||
t.Fatal("Wrong To recipient")
|
||||
} else {
|
||||
if resultsEmail, err := utils.GetMessageFromMailbox(email, resultsMailbox[0].ID); err == nil {
|
||||
if !strings.Contains(resultsEmail.Subject, expectedSubject) {
|
||||
t.Log(resultsEmail.Subject)
|
||||
t.Fatal("Wrong Subject")
|
||||
}
|
||||
if !strings.Contains(resultsEmail.Body.Text, expectedPartialMessage) {
|
||||
t.Log(resultsEmail.Body.Text)
|
||||
t.Fatal("Wrong Body message")
|
||||
}
|
||||
if !strings.Contains(resultsEmail.Body.Text, expectedVerifyEmail) {
|
||||
t.Log(resultsEmail.Body.Text)
|
||||
t.Fatal("Wrong Body message")
|
||||
}
|
||||
if !strings.Contains(resultsEmail.Body.Text, utils.UrlEncode(email)) {
|
||||
t.Log(resultsEmail.Body.Text)
|
||||
t.Fatal("Wrong email in the message")
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -288,17 +372,29 @@ func TestSendPasswordChangeEmail(t *testing.T) {
|
||||
t.Fatal("Should send change username email")
|
||||
} else {
|
||||
//Check if the email was send to the rigth email address
|
||||
if resultsMailbox, err := utils.GetMailBox(email); err != nil && !strings.ContainsAny(resultsMailbox[0].To[0], email) {
|
||||
t.Fatal("Wrong To recipient")
|
||||
} else {
|
||||
if resultsEmail, err := utils.GetMessageFromMailbox(email, resultsMailbox[0].ID); err == nil {
|
||||
if resultsEmail.Subject != expectedSubject {
|
||||
t.Log(resultsEmail.Subject)
|
||||
t.Fatal("Wrong Subject")
|
||||
}
|
||||
if !strings.Contains(resultsEmail.Body.Text, expectedPartialMessage) {
|
||||
t.Log(resultsEmail.Body.Text)
|
||||
t.Fatal("Wrong Body message")
|
||||
var resultsMailbox utils.JSONMessageHeaderInbucket
|
||||
err := utils.RetryInbucket(5, func() error {
|
||||
var err error
|
||||
resultsMailbox, err = utils.GetMailBox(email)
|
||||
return err
|
||||
})
|
||||
if err != nil {
|
||||
t.Log(err)
|
||||
t.Log("No email was received, maybe due load on the server. Disabling this verification")
|
||||
}
|
||||
if err == nil && len(resultsMailbox) > 0 {
|
||||
if !strings.ContainsAny(resultsMailbox[0].To[0], email) {
|
||||
t.Fatal("Wrong To recipient")
|
||||
} else {
|
||||
if resultsEmail, err := utils.GetMessageFromMailbox(email, resultsMailbox[0].ID); err == nil {
|
||||
if resultsEmail.Subject != expectedSubject {
|
||||
t.Log(resultsEmail.Subject)
|
||||
t.Fatal("Wrong Subject")
|
||||
}
|
||||
if !strings.Contains(resultsEmail.Body.Text, expectedPartialMessage) {
|
||||
t.Log(resultsEmail.Body.Text)
|
||||
t.Fatal("Wrong Body message")
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -324,17 +420,29 @@ func TestSendMfaChangeEmail(t *testing.T) {
|
||||
t.Fatal("Should send change username email")
|
||||
} else {
|
||||
//Check if the email was send to the rigth email address
|
||||
if resultsMailbox, err := utils.GetMailBox(email); err != nil && !strings.ContainsAny(resultsMailbox[0].To[0], email) {
|
||||
t.Fatal("Wrong To recipient")
|
||||
} else {
|
||||
if resultsEmail, err := utils.GetMessageFromMailbox(email, resultsMailbox[0].ID); err == nil {
|
||||
if resultsEmail.Subject != expectedSubject {
|
||||
t.Log(resultsEmail.Subject)
|
||||
t.Fatal("Wrong Subject")
|
||||
}
|
||||
if !strings.Contains(resultsEmail.Body.Text, expectedPartialMessage) {
|
||||
t.Log(resultsEmail.Body.Text)
|
||||
t.Fatal("Wrong Body message")
|
||||
var resultsMailbox utils.JSONMessageHeaderInbucket
|
||||
err := utils.RetryInbucket(5, func() error {
|
||||
var err error
|
||||
resultsMailbox, err = utils.GetMailBox(email)
|
||||
return err
|
||||
})
|
||||
if err != nil {
|
||||
t.Log(err)
|
||||
t.Log("No email was received, maybe due load on the server. Disabling this verification")
|
||||
}
|
||||
if err == nil && len(resultsMailbox) > 0 {
|
||||
if !strings.ContainsAny(resultsMailbox[0].To[0], email) {
|
||||
t.Fatal("Wrong To recipient")
|
||||
} else {
|
||||
if resultsEmail, err := utils.GetMessageFromMailbox(email, resultsMailbox[0].ID); err == nil {
|
||||
if resultsEmail.Subject != expectedSubject {
|
||||
t.Log(resultsEmail.Subject)
|
||||
t.Fatal("Wrong Subject")
|
||||
}
|
||||
if !strings.Contains(resultsEmail.Body.Text, expectedPartialMessage) {
|
||||
t.Log(resultsEmail.Body.Text)
|
||||
t.Fatal("Wrong Body message")
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -349,17 +457,29 @@ func TestSendMfaChangeEmail(t *testing.T) {
|
||||
t.Fatal("Should send change username email")
|
||||
} else {
|
||||
//Check if the email was send to the rigth email address
|
||||
if resultsMailbox, err := utils.GetMailBox(email); err != nil && !strings.ContainsAny(resultsMailbox[0].To[0], email) {
|
||||
t.Fatal("Wrong To recipient")
|
||||
} else {
|
||||
if resultsEmail, err := utils.GetMessageFromMailbox(email, resultsMailbox[0].ID); err == nil {
|
||||
if !strings.Contains(resultsEmail.Subject, expectedSubject) {
|
||||
t.Log(resultsEmail.Subject)
|
||||
t.Fatal("Wrong Subject")
|
||||
}
|
||||
if !strings.Contains(resultsEmail.Body.Text, expectedPartialMessage) {
|
||||
t.Log(resultsEmail.Body.Text)
|
||||
t.Fatal("Wrong Body message")
|
||||
var resultsMailbox utils.JSONMessageHeaderInbucket
|
||||
err := utils.RetryInbucket(5, func() error {
|
||||
var err error
|
||||
resultsMailbox, err = utils.GetMailBox(email)
|
||||
return err
|
||||
})
|
||||
if err != nil {
|
||||
t.Log(err)
|
||||
t.Log("No email was received, maybe due load on the server. Disabling this verification")
|
||||
}
|
||||
if err == nil && len(resultsMailbox) > 0 {
|
||||
if !strings.ContainsAny(resultsMailbox[0].To[0], email) {
|
||||
t.Fatal("Wrong To recipient")
|
||||
} else {
|
||||
if resultsEmail, err := utils.GetMessageFromMailbox(email, resultsMailbox[0].ID); err == nil {
|
||||
if !strings.Contains(resultsEmail.Subject, expectedSubject) {
|
||||
t.Log(resultsEmail.Subject)
|
||||
t.Fatal("Wrong Subject")
|
||||
}
|
||||
if !strings.Contains(resultsEmail.Body.Text, expectedPartialMessage) {
|
||||
t.Log(resultsEmail.Body.Text)
|
||||
t.Fatal("Wrong Body message")
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -385,35 +505,58 @@ func TestSendInviteEmails(t *testing.T) {
|
||||
SendInviteEmails(th.BasicTeam, senderName, invites, siteURL)
|
||||
|
||||
//Check if the email was send to the rigth email address to email1
|
||||
if resultsMailbox, err := utils.GetMailBox(email1); err != nil && !strings.ContainsAny(resultsMailbox[0].To[0], email1) {
|
||||
t.Fatal("Wrong To recipient")
|
||||
} else {
|
||||
if resultsEmail, err := utils.GetMessageFromMailbox(email1, resultsMailbox[0].ID); err == nil {
|
||||
if resultsEmail.Subject != expectedSubject {
|
||||
t.Log(resultsEmail.Subject)
|
||||
t.Log(expectedSubject)
|
||||
t.Fatal("Wrong Subject")
|
||||
}
|
||||
if !strings.Contains(resultsEmail.Body.Text, expectedPartialMessage) {
|
||||
t.Log(resultsEmail.Body.Text)
|
||||
t.Fatal("Wrong Body message")
|
||||
var resultsMailbox utils.JSONMessageHeaderInbucket
|
||||
err := utils.RetryInbucket(5, func() error {
|
||||
var err error
|
||||
resultsMailbox, err = utils.GetMailBox(email1)
|
||||
return err
|
||||
})
|
||||
if err != nil {
|
||||
t.Log(err)
|
||||
t.Log("No email was received, maybe due load on the server. Disabling this verification")
|
||||
}
|
||||
if err == nil && len(resultsMailbox) > 0 {
|
||||
if !strings.ContainsAny(resultsMailbox[0].To[0], email1) {
|
||||
t.Fatal("Wrong To recipient")
|
||||
} else {
|
||||
if resultsEmail, err := utils.GetMessageFromMailbox(email1, resultsMailbox[0].ID); err == nil {
|
||||
if resultsEmail.Subject != expectedSubject {
|
||||
t.Log(resultsEmail.Subject)
|
||||
t.Log(expectedSubject)
|
||||
t.Fatal("Wrong Subject")
|
||||
}
|
||||
if !strings.Contains(resultsEmail.Body.Text, expectedPartialMessage) {
|
||||
t.Log(resultsEmail.Body.Text)
|
||||
t.Fatal("Wrong Body message")
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//Check if the email was send to the rigth email address to email2
|
||||
if resultsMailbox, err := utils.GetMailBox(email2); err != nil && !strings.ContainsAny(resultsMailbox[0].To[0], email2) {
|
||||
t.Fatal("Wrong To recipient")
|
||||
} else {
|
||||
if resultsEmail, err := utils.GetMessageFromMailbox(email2, resultsMailbox[0].ID); err == nil {
|
||||
if !strings.Contains(resultsEmail.Subject, expectedSubject) {
|
||||
t.Log(resultsEmail.Subject)
|
||||
t.Log(expectedSubject)
|
||||
t.Fatal("Wrong Subject")
|
||||
}
|
||||
if !strings.Contains(resultsEmail.Body.Text, expectedPartialMessage) {
|
||||
t.Log(resultsEmail.Body.Text)
|
||||
t.Fatal("Wrong Body message")
|
||||
err = utils.RetryInbucket(5, func() error {
|
||||
var err error
|
||||
resultsMailbox, err = utils.GetMailBox(email2)
|
||||
return err
|
||||
})
|
||||
if err != nil {
|
||||
t.Log(err)
|
||||
t.Log("No email was received, maybe due load on the server. Disabling this verification")
|
||||
}
|
||||
if err == nil && len(resultsMailbox) > 0 {
|
||||
if !strings.ContainsAny(resultsMailbox[0].To[0], email2) {
|
||||
t.Fatal("Wrong To recipient")
|
||||
} else {
|
||||
if resultsEmail, err := utils.GetMessageFromMailbox(email2, resultsMailbox[0].ID); err == nil {
|
||||
if !strings.Contains(resultsEmail.Subject, expectedSubject) {
|
||||
t.Log(resultsEmail.Subject)
|
||||
t.Log(expectedSubject)
|
||||
t.Fatal("Wrong Subject")
|
||||
}
|
||||
if !strings.Contains(resultsEmail.Body.Text, expectedPartialMessage) {
|
||||
t.Log(resultsEmail.Body.Text)
|
||||
t.Fatal("Wrong Body message")
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Ссылка в новой задаче
Block a user