forked from Silverfish/proton-bridge
GODT-1076 Fix UIDPLUS response for importing existing message
This commit is contained in:
@ -181,7 +181,7 @@ func (im *imapMailbox) createMessage(flags []string, date time.Time, body imap.L
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
targetSeq := im.storeMailbox.GetUIDList([]string{m.ID})
|
targetSeq := im.storeMailbox.GetUIDList(IDs)
|
||||||
return uidplus.AppendResponse(im.storeMailbox.UIDValidity(), targetSeq)
|
return uidplus.AppendResponse(im.storeMailbox.UIDValidity(), targetSeq)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -150,3 +150,31 @@ Feature: IMAP import messages
|
|||||||
|
|
||||||
"""
|
"""
|
||||||
Then IMAP response is "OK"
|
Then IMAP response is "OK"
|
||||||
|
|
||||||
|
# We cannot control internal IDs on live server.
|
||||||
|
@ignore-live
|
||||||
|
Scenario: Import existing message
|
||||||
|
When IMAP client imports message to "INBOX"
|
||||||
|
"""
|
||||||
|
From: Foo <foo@example.com>
|
||||||
|
To: Bridge Test <bridgetest@pm.test>
|
||||||
|
Subject: Hello
|
||||||
|
Received: by 2002:0:0:0:0:0:0:0 with SMTP id 0123456789abcdef; Wed, 30 Dec 2020 01:23:45 0000
|
||||||
|
X-Pm-Internal-Id: 1
|
||||||
|
|
||||||
|
Hello
|
||||||
|
|
||||||
|
"""
|
||||||
|
Then IMAP response is "OK \[APPENDUID \d 1\] APPEND completed"
|
||||||
|
When IMAP client imports message to "INBOX"
|
||||||
|
"""
|
||||||
|
From: Foo <foo@example.com>
|
||||||
|
To: Bridge Test <bridgetest@pm.test>
|
||||||
|
Subject: Hello
|
||||||
|
Received: by 2002:0:0:0:0:0:0:0 with SMTP id 0123456789abcdef; Wed, 30 Dec 2020 01:23:45 0000
|
||||||
|
X-Pm-Internal-Id: 1
|
||||||
|
|
||||||
|
Hello
|
||||||
|
|
||||||
|
"""
|
||||||
|
Then IMAP response is "OK \[APPENDUID \d 1\] APPEND completed"
|
||||||
|
|||||||
@ -19,6 +19,7 @@ package tests
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"strconv"
|
"strconv"
|
||||||
|
"strings"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/cucumber/godog"
|
"github.com/cucumber/godog"
|
||||||
@ -47,9 +48,12 @@ func imapResponseIs(expectedResponse string) error {
|
|||||||
|
|
||||||
func imapResponseNamedIs(clientID, expectedResponse string) error {
|
func imapResponseNamedIs(clientID, expectedResponse string) error {
|
||||||
res := ctx.GetIMAPLastResponse(clientID)
|
res := ctx.GetIMAPLastResponse(clientID)
|
||||||
if expectedResponse == "OK" {
|
switch {
|
||||||
|
case expectedResponse == "OK":
|
||||||
res.AssertOK()
|
res.AssertOK()
|
||||||
} else {
|
case strings.HasPrefix(expectedResponse, "OK"):
|
||||||
|
res.AssertResult(expectedResponse)
|
||||||
|
default:
|
||||||
res.AssertError(expectedResponse)
|
res.AssertError(expectedResponse)
|
||||||
}
|
}
|
||||||
return ctx.GetTestingError()
|
return ctx.GetTestingError()
|
||||||
|
|||||||
@ -107,6 +107,13 @@ func (ir *IMAPResponse) AssertOK() *IMAPResponse {
|
|||||||
return ir
|
return ir
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (ir *IMAPResponse) AssertResult(wantResult string) *IMAPResponse {
|
||||||
|
ir.wait()
|
||||||
|
a.NoError(ir.t, ir.err)
|
||||||
|
a.Regexp(ir.t, wantResult, ir.result, "Expected result %s but got %s", wantResult, ir.result)
|
||||||
|
return ir
|
||||||
|
}
|
||||||
|
|
||||||
func (ir *IMAPResponse) AssertError(wantErrMsg string) *IMAPResponse {
|
func (ir *IMAPResponse) AssertError(wantErrMsg string) *IMAPResponse {
|
||||||
ir.wait()
|
ir.wait()
|
||||||
if ir.err == nil {
|
if ir.err == nil {
|
||||||
|
|||||||
Reference in New Issue
Block a user