@@ -14,40 +14,70 @@ func TestClose(t *testing.T) {
1414 // This test is still useful as we have no way of checking the fetch responses after the store command.
1515 // Additionally, we also need to ensure that there are no unilateral EXPUNGE messages returned from the server after close.
1616 // There is currently no way to check for this with the go imap client.
17- runOneToOneTestWithAuth (t , defaultServerOptions (t ), func (c * testConnection , _ * testSession ) {
18- c .C ("b001 CREATE saved-messages" )
19- c .S ("b001 OK CREATE" )
17+ runManyToOneTestWithAuth (t , defaultServerOptions (t ), [] int { 1 , 2 }, func (c map [ int ] * testConnection , _ * testSession ) {
18+ c [ 1 ] .C ("b001 CREATE saved-messages" )
19+ c [ 1 ] .S ("b001 OK CREATE" )
2020
21- c .doAppend (`saved-messages` , `To: 1@pm.me` , `\Seen` ).expect ("OK" )
22- c .doAppend (`saved-messages` , `To: 2@pm.me` ).expect ("OK" )
23- c .doAppend (`saved-messages` , `To: 3@pm.me` , `\Seen` ).expect ("OK" )
24- c .doAppend (`saved-messages` , `To: 4@pm.me` ).expect ("OK" )
25- c .doAppend (`saved-messages` , `To: 5@pm.me` , `\Seen` ).expect ("OK" )
21+ c [ 1 ] .doAppend (`saved-messages` , `To: 1@pm.me` , `\Seen` ).expect ("OK" )
22+ c [ 1 ] .doAppend (`saved-messages` , `To: 2@pm.me` ).expect ("OK" )
23+ c [ 1 ] .doAppend (`saved-messages` , `To: 3@pm.me` , `\Seen` ).expect ("OK" )
24+ c [ 1 ] .doAppend (`saved-messages` , `To: 4@pm.me` ).expect ("OK" )
25+ c [ 1 ] .doAppend (`saved-messages` , `To: 5@pm.me` , `\Seen` ).expect ("OK" )
2626
27- c .C (`A002 SELECT saved-messages` )
28- c .Se (`A002 OK [READ-WRITE] SELECT` )
27+ c [1 ].C (`A002 SELECT saved-messages` )
28+ c [1 ].Se (`A002 OK [READ-WRITE] SELECT` )
29+
30+ c [2 ].C (`B001 SELECT saved-messages` )
31+ c [2 ].Se (`B001 OK [READ-WRITE] SELECT` )
32+ c [2 ].C (`B002 FETCH 1:* (UID FLAGS)` )
33+ c [2 ].S (
34+ `* 1 FETCH (UID 1 FLAGS (\Seen))` ,
35+ `* 2 FETCH (UID 2 FLAGS ())` ,
36+ `* 3 FETCH (UID 3 FLAGS (\Seen))` ,
37+ `* 4 FETCH (UID 4 FLAGS ())` ,
38+ `* 5 FETCH (UID 5 FLAGS (\Seen))` ,
39+ )
40+ c [2 ].OK ("B002" )
2941
3042 // TODO: Match flags in any order.
31- c .C (`A003 STORE 1 +FLAGS (\Deleted)` )
32- c .S (`* 1 FETCH (FLAGS (\Deleted \Recent \Seen))` )
33- c .Sx ("A003 OK.*" )
43+ c [ 1 ] .C (`A003 STORE 1 +FLAGS (\Deleted)` )
44+ c [ 1 ] .S (`* 1 FETCH (FLAGS (\Deleted \Recent \Seen))` )
45+ c [ 1 ] .Sx ("A003 OK.*" )
3446
35- c .C (`A004 STORE 2 +FLAGS (\Deleted)` )
36- c .S (`* 2 FETCH (FLAGS (\Deleted \Recent))` )
37- c .Sx ("A004 OK.*" )
47+ c [ 1 ] .C (`A004 STORE 2 +FLAGS (\Deleted)` )
48+ c [ 1 ] .S (`* 2 FETCH (FLAGS (\Deleted \Recent))` )
49+ c [ 1 ] .Sx ("A004 OK.*" )
3850
39- c .C (`A005 STORE 3 +FLAGS (\Deleted)` )
40- c .S (`* 3 FETCH (FLAGS (\Deleted \Recent \Seen))` )
41- c .Sx ("A005 OK.*" )
51+ c [1 ].C (`A005 STORE 3 +FLAGS (\Deleted)` )
52+ c [1 ].S (`* 3 FETCH (FLAGS (\Deleted \Recent \Seen))` )
53+ c [1 ].Sx ("A005 OK.*" )
54+
55+ c [2 ].C ("B003 NOOP" )
56+ c [2 ].S (
57+ `* 1 FETCH (FLAGS (\Deleted \Seen))` ,
58+ `* 2 FETCH (FLAGS (\Deleted))` ,
59+ `* 3 FETCH (FLAGS (\Deleted \Seen))` ,
60+ )
61+ c [2 ].OK ("B003" )
4262
43- // TODO: GOMSRV-106 - Ensure this also works for cases where multiple clients have the same mailbox open
44- c .C (`A202 CLOSE` )
45- c .S ("A202 OK CLOSE" )
63+ c [2 ].C ("B004 UID EXPUNGE 1" )
64+ c [2 ].Se (`* 1 EXPUNGE` )
65+ c [2 ].OK ("B004" )
66+
67+ c [1 ].C (`A202 CLOSE` )
68+ c [1 ].S ("A202 OK CLOSE" )
69+
70+ c [2 ].C ("B003 NOOP" )
71+ c [2 ].S (
72+ `* 1 EXPUNGE` ,
73+ `* 1 EXPUNGE` ,
74+ )
75+ c [2 ].OK ("B003" )
4676
4777 // There are 2 messages in saved-messages.
48- c .C (`A006 STATUS saved-messages (MESSAGES)` )
49- c .S (`* STATUS "saved-messages" (MESSAGES 2)` )
50- c .S (`A006 OK STATUS` )
78+ c [ 1 ] .C (`A006 STATUS saved-messages (MESSAGES)` )
79+ c [ 1 ] .S (`* STATUS "saved-messages" (MESSAGES 2)` )
80+ c [ 1 ] .S (`A006 OK STATUS` )
5181 })
5282}
5383
0 commit comments