Skip to content

Commit a48b2ea

Browse files
committed
Add constant with builtin extensions for tests
1 parent 56006d1 commit a48b2ea

File tree

3 files changed

+10
-7
lines changed

3 files changed

+10
-7
lines changed

server/cmd_any_test.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ func TestCapability(t *testing.T) {
2727
io.WriteString(c, "a001 CAPABILITY\r\n")
2828

2929
scanner.Scan()
30-
if scanner.Text() != "* CAPABILITY IMAP4rev1 LITERAL+ SASL-IR SPECIAL-USE CHILDREN UNSELECT COMPRESS=DEFLATE APPENDLIMIT AUTH=PLAIN" {
30+
if scanner.Text() != "* CAPABILITY IMAP4rev1 "+builtinExtensions+" AUTH=PLAIN" {
3131
t.Fatal("Bad capability:", scanner.Text())
3232
}
3333

@@ -88,7 +88,7 @@ func TestServer_Enable(t *testing.T) {
8888
io.WriteString(c, "a001 CAPABILITY\r\n")
8989

9090
scanner.Scan()
91-
if scanner.Text() != "* CAPABILITY IMAP4rev1 LITERAL+ SASL-IR SPECIAL-USE CHILDREN UNSELECT COMPRESS=DEFLATE APPENDLIMIT AUTH=PLAIN XNOOP" {
91+
if scanner.Text() != "* CAPABILITY IMAP4rev1 "+builtinExtensions+" AUTH=PLAIN XNOOP" {
9292
t.Fatal("Bad capability:", scanner.Text())
9393
}
9494

@@ -117,8 +117,8 @@ func TestServer_EnableAuth(t *testing.T) {
117117
io.WriteString(c, "a001 CAPABILITY\r\n")
118118

119119
scanner.Scan()
120-
if scanner.Text() != "* CAPABILITY IMAP4rev1 LITERAL+ SASL-IR SPECIAL-USE CHILDREN UNSELECT COMPRESS=DEFLATE APPENDLIMIT AUTH=PLAIN AUTH=XNOOP" &&
121-
scanner.Text() != "* CAPABILITY IMAP4rev1 LITERAL+ SASL-IR SPECIAL-USE CHILDREN UNSELECT COMPRESS=DEFLATE APPENDLIMIT AUTH=XNOOP AUTH=PLAIN" {
120+
if scanner.Text() != "* CAPABILITY IMAP4rev1 "+builtinExtensions+" AUTH=PLAIN AUTH=XNOOP" &&
121+
scanner.Text() != "* CAPABILITY IMAP4rev1 "+builtinExtensions+" AUTH=XNOOP AUTH=PLAIN" {
122122
t.Fatal("Bad capability:", scanner.Text())
123123
}
124124

server/cmd_noauth_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ func testServerTLS(t *testing.T) (s *server.Server, c net.Conn, scanner *bufio.S
3030

3131
io.WriteString(c, "a001 CAPABILITY\r\n")
3232
scanner.Scan()
33-
if scanner.Text() != "* CAPABILITY IMAP4rev1 LITERAL+ SASL-IR SPECIAL-USE CHILDREN UNSELECT COMPRESS=DEFLATE APPENDLIMIT STARTTLS LOGINDISABLED" {
33+
if scanner.Text() != "* CAPABILITY IMAP4rev1 "+builtinExtensions+" STARTTLS LOGINDISABLED" {
3434
t.Fatal("Bad CAPABILITY response:", scanner.Text())
3535
}
3636
scanner.Scan()
@@ -61,7 +61,7 @@ func TestStartTLS(t *testing.T) {
6161
io.WriteString(c, "a001 CAPABILITY\r\n")
6262

6363
scanner.Scan()
64-
if scanner.Text() != "* CAPABILITY IMAP4rev1 LITERAL+ SASL-IR SPECIAL-USE CHILDREN UNSELECT COMPRESS=DEFLATE APPENDLIMIT AUTH=PLAIN" {
64+
if scanner.Text() != "* CAPABILITY IMAP4rev1 "+builtinExtensions+" AUTH=PLAIN" {
6565
t.Fatal("Bad CAPABILITY response:", scanner.Text())
6666
}
6767
}

server/server_test.go

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,9 @@ import (
99
"github.com/emersion/go-imap/server"
1010
)
1111

12+
// Extnesions that are always advertised by go-imap server.
13+
const builtinExtensions = "LITERAL+ SASL-IR SPECIAL-USE CHILDREN UNSELECT COMPRESS=DEFLATE APPENDLIMIT"
14+
1215
func testServer(t *testing.T) (s *server.Server, conn net.Conn) {
1316
bkd := memory.New()
1417

@@ -40,7 +43,7 @@ func TestServer_greeting(t *testing.T) {
4043
scanner.Scan() // Wait for greeting
4144
greeting := scanner.Text()
4245

43-
if greeting != "* OK [CAPABILITY IMAP4rev1 LITERAL+ SASL-IR SPECIAL-USE CHILDREN UNSELECT COMPRESS=DEFLATE APPENDLIMIT AUTH=PLAIN] IMAP4rev1 Service Ready" {
46+
if greeting != "* OK [CAPABILITY IMAP4rev1 "+builtinExtensions+" AUTH=PLAIN] IMAP4rev1 Service Ready" {
4447
t.Fatal("Bad greeting:", greeting)
4548
}
4649
}

0 commit comments

Comments
 (0)