MCPcopy Create free account
hub / github.com/foxcpp/maddy / TestMultipleDomains_SeparateNamespace

Function TestMultipleDomains_SeparateNamespace

tests/multiple_domains_test.go:31–126  ·  view source on GitHub ↗

Test cases based on https://maddy.email/multiple-domains/

(tt *testing.T)

Source from the content-addressed store, hash-verified

29// Test cases based on https://maddy.email/multiple-domains/
30
31func TestMultipleDomains_SeparateNamespace(tt *testing.T) {
32 tt.Parallel()
33 t := tests.NewT(tt)
34 t.DNS(nil)
35 t.Port("submission")
36 t.Port("imap")
37 t.Config(`
38 tls off
39 hostname test.maddy.email
40
41 auth.pass_table local_authdb {
42 table sql_table {
43 driver sqlite3
44 dsn credentials.db
45 table_name passwords
46 }
47 }
48 storage.imapsql local_mailboxes {
49 driver sqlite3
50 dsn imapsql.db
51 }
52
53 submission tcp://0.0.0.0:{env:TEST_PORT_submission} {
54 auth &local_authdb
55 reject
56 }
57 imap tcp://127.0.0.1:{env:TEST_PORT_imap} {
58 auth &local_authdb
59 storage &local_mailboxes
60 }
61 `)
62
63 t.MustRunCLIGroup(
64 []string{"creds", "create", "-p", "user1", "user1@test1.maddy.email"},
65 []string{"creds", "create", "-p", "user2", "user2@test1.maddy.email"},
66 []string{"creds", "create", "-p", "user3", "user1@test2.maddy.email"},
67 []string{"imap-acct", "create", "--no-specialuse", "user1@test1.maddy.email"},
68 []string{"imap-acct", "create", "--no-specialuse", "user2@test1.maddy.email"},
69 []string{"imap-acct", "create", "--no-specialuse", "user1@test2.maddy.email"},
70 )
71 t.Run(2)
72
73 user1 := t.Conn("imap")
74 defer user1.Close()
75 user1.ExpectPattern(`\* OK *`)
76 user1.Writeln(`. LOGIN user1@test1.maddy.email user1`)
77 user1.ExpectPattern(`. OK *`)
78 user1.Writeln(`. CREATE user1`)
79 user1.ExpectPattern(`. OK *`)
80
81 user1SMTP := t.Conn("submission")
82 defer user1SMTP.Close()
83 user1SMTP.SMTPNegotation("localhost", []string{"AUTH PLAIN"}, nil)
84 user1SMTP.SMTPPlainAuth("user1@test1.maddy.email", "user1", true)
85
86 user2 := t.Conn("imap")
87 defer user2.Close()
88 user2.ExpectPattern(`\* OK *`)

Callers

nothing calls this directly

Calls 13

DNSMethod · 0.95
PortMethod · 0.95
ConfigMethod · 0.95
MustRunCLIGroupMethod · 0.95
RunMethod · 0.95
ConnMethod · 0.95
NewTFunction · 0.92
ExpectPatternMethod · 0.80
WritelnMethod · 0.80
SMTPNegotationMethod · 0.80
SMTPPlainAuthMethod · 0.80
ExpectMethod · 0.80

Tested by

no test coverage detected