-
Notifications
You must be signed in to change notification settings - Fork 27
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: Properly handle store flags (when replacing)
- Loading branch information
1 parent
70cb2f6
commit aa07443
Showing
3 changed files
with
52 additions
and
32 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
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 |
---|---|---|
@@ -1,6 +1,7 @@ | ||
package tests | ||
|
||
import ( | ||
"fmt" | ||
"testing" | ||
|
||
goimap "github.com/emersion/go-imap" | ||
|
@@ -116,6 +117,41 @@ func TestStoreSilent(t *testing.T) { | |
}) | ||
} | ||
|
||
func TestStoreReadUnread(t *testing.T) { | ||
runManyToOneTestWithAuth(t, defaultServerOptions(t), []int{1, 2}, func(c map[int]*testConnection, _ *testSession) { | ||
c[1].C(`tag select inbox`).OK(`tag`) | ||
c[2].C(`tag select inbox`).OK(`tag`) | ||
|
||
for i := 1; i <= 10; i++ { | ||
c[1].doAppend(`INBOX`, fmt.Sprintf(`To: %[email protected]`, i)).expect("OK") | ||
|
||
c[1].C(`tag noop`).OK(`tag`) | ||
c[2].C(`tag noop`).OK(`tag`) | ||
} | ||
|
||
for i := 1; i <= 10; i++ { | ||
// Begin IDLEing on session 2. | ||
c[2].C(`tag idle`).Continue() | ||
|
||
// Mark the message as read with session 1. | ||
c[1].Cf(`tag UID STORE %v +FLAGS.SILENT (\Seen)`, i).OK(`tag`) | ||
|
||
// Mark the message as read with session 1. | ||
c[1].Cf(`tag UID STORE %v FLAGS.SILENT (\Seen)`, i).OK(`tag`) | ||
|
||
// Wait for the untagged FETCH response on session 2. | ||
c[2].S(fmt.Sprintf(`* %v FETCH (FLAGS (\Seen))`, i)) | ||
|
||
// End IDLEing on session 2. | ||
c[2].C(`DONE`).OK(`tag`) | ||
|
||
// Both sessions should see the message as read. | ||
c[1].Cf(`tag UID FETCH %v (FLAGS)`, i).Sxe(`\Seen`).OK(`tag`) | ||
c[2].Cf(`tag UID FETCH %v (FLAGS)`, i).Sxe(`\Seen`).OK(`tag`) | ||
} | ||
}) | ||
} | ||
|
||
func TestUIDStore(t *testing.T) { | ||
runOneToOneTestWithAuth(t, defaultServerOptions(t), func(c *testConnection, _ *testSession) { | ||
c.C("b001 CREATE saved-messages") | ||
|