MCPcopy Index your code
hub / github.com/foxcpp/maddy / TestImapsqlDeliveryMap

Function TestImapsqlDeliveryMap

tests/imapsql_test.go:116–186  ·  view source on GitHub ↗
(tt *testing.T)

Source from the content-addressed store, hash-verified

114}
115
116func TestImapsqlDeliveryMap(tt *testing.T) {
117 tt.Parallel()
118 t := tests.NewT(tt)
119
120 t.DNS(nil)
121 t.Port("imap")
122 t.Port("smtp")
123 t.Config(`
124 storage.imapsql test_store {
125 delivery_map email_localpart
126 auth_normalize precis
127
128 driver sqlite3
129 dsn imapsql.db
130 }
131
132 imap tcp://127.0.0.1:{env:TEST_PORT_imap} {
133 tls off
134
135 auth dummy
136 storage &test_store
137 }
138
139 smtp tcp://127.0.0.1:{env:TEST_PORT_smtp} {
140 hostname maddy.test
141 tls off
142
143 deliver_to &test_store
144 }
145 `)
146 t.Run(2)
147 defer t.Close()
148
149 imapConn := t.Conn("imap")
150 defer imapConn.Close()
151 imapConn.ExpectPattern(`\* OK *`)
152 imapConn.Writeln(". LOGIN testusr 1234")
153 imapConn.ExpectPattern(". OK *")
154 imapConn.Writeln(". SELECT INBOX")
155 imapConn.ExpectPattern(`\* *`)
156 imapConn.ExpectPattern(`\* *`)
157 imapConn.ExpectPattern(`\* *`)
158 imapConn.ExpectPattern(`\* *`)
159 imapConn.ExpectPattern(`\* *`)
160 imapConn.ExpectPattern(`\* *`)
161 imapConn.ExpectPattern(`. OK *`)
162
163 smtpConn := t.Conn("smtp")
164 defer smtpConn.Close()
165 smtpConn.SMTPNegotation("localhost", nil, nil)
166 smtpConn.Writeln("MAIL FROM:<sender@maddy.test>")
167 smtpConn.ExpectPattern("2*")
168 smtpConn.Writeln("RCPT TO:<testusr@maddy.test>")
169 smtpConn.ExpectPattern("2*")
170 smtpConn.Writeln("DATA")
171 smtpConn.ExpectPattern("354 *")
172 smtpConn.Writeln("From: <sender@maddy.test>")
173 smtpConn.Writeln("To: <testusr@maddy.test>")

Callers

nothing calls this directly

Calls 11

DNSMethod · 0.95
PortMethod · 0.95
ConfigMethod · 0.95
RunMethod · 0.95
CloseMethod · 0.95
ConnMethod · 0.95
NewTFunction · 0.92
ExpectPatternMethod · 0.80
WritelnMethod · 0.80
SMTPNegotationMethod · 0.80
CloseMethod · 0.65

Tested by

no test coverage detected