summaryrefslogtreecommitdiffstats
path: root/api4
diff options
context:
space:
mode:
authorCarlos Tadeu Panato Junior <ctadeu@gmail.com>2017-03-11 23:39:00 +0100
committerenahum <nahumhbl@gmail.com>2017-03-11 19:39:00 -0300
commit11f1859de12be22726a93bb0fd201f3d692022a0 (patch)
treeffec8cda431c9682dcad870868fe938861a2dc35 /api4
parentb756ae17c08cebc4a6a0baefc2edf5c4f1cf42cb (diff)
downloadchat-11f1859de12be22726a93bb0fd201f3d692022a0.tar.gz
chat-11f1859de12be22726a93bb0fd201f3d692022a0.tar.bz2
chat-11f1859de12be22726a93bb0fd201f3d692022a0.zip
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.
Diffstat (limited to 'api4')
-rw-r--r--api4/user_test.go28
1 files changed, 20 insertions, 8 deletions
diff --git a/api4/user_test.go b/api4/user_test.go
index c03169c72..4ef1505e7 100644
--- a/api4/user_test.go
+++ b/api4/user_test.go
@@ -789,14 +789,26 @@ func TestResetPassword(t *testing.T) {
}
// Check if the email was send to the right email address and the recovery key match
- if resultsMailbox, err := utils.GetMailBox(user.Email); err != nil && !strings.ContainsAny(resultsMailbox[0].To[0], user.Email) {
- t.Fatal("Wrong To recipient")
- } else {
- if resultsEmail, err := utils.GetMessageFromMailbox(user.Email, resultsMailbox[0].ID); err == nil {
- if !strings.Contains(resultsEmail.Body.Text, recovery.Code) {
- t.Log(resultsEmail.Body.Text)
- t.Log(recovery.Code)
- t.Fatal("Received wrong recovery code")
+ var resultsMailbox utils.JSONMessageHeaderInbucket
+ err := utils.RetryInbucket(5, func() error {
+ var err error
+ resultsMailbox, err = utils.GetMailBox(user.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], user.Email) {
+ t.Fatal("Wrong To recipient")
+ } else {
+ if resultsEmail, err := utils.GetMessageFromMailbox(user.Email, resultsMailbox[0].ID); err == nil {
+ if !strings.Contains(resultsEmail.Body.Text, recovery.Code) {
+ t.Log(resultsEmail.Body.Text)
+ t.Log(recovery.Code)
+ t.Fatal("Received wrong recovery code")
+ }
}
}
}