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

Function TestLMTPClient_Issue308

tests/lmtp_test.go:133–181  ·  view source on GitHub ↗
(tt *testing.T)

Source from the content-addressed store, hash-verified

131}
132
133func TestLMTPClient_Issue308(tt *testing.T) {
134 t := tests.NewT(tt)
135 t.DNS(nil)
136 t.Port("smtp")
137 tgtPort := t.Port("target")
138 t.Config(`
139 hostname mx.maddy.test
140 tls off
141
142 target.lmtp local_mailboxes {
143 targets tcp://127.0.0.1:{env:TEST_PORT_target}
144 }
145
146 smtp tcp://127.0.0.1:{env:TEST_PORT_smtp} {
147 deliver_to &local_mailboxes
148 }`)
149 t.Run(1)
150 defer t.Close()
151
152 be, s := testutils.SMTPServer(tt, "127.0.0.1:"+strconv.Itoa(int(tgtPort)))
153 s.LMTP = true
154 be.LMTPDataErr = []error{nil, nil}
155 defer s.Close()
156
157 c := t.Conn("smtp")
158 defer c.Close()
159 c.SMTPNegotation("client.maddy.test", nil, nil)
160 c.Writeln("MAIL FROM:<from@maddy.test>")
161 c.ExpectPattern("250 *")
162 c.Writeln("RCPT TO:<to1@maddy.test>")
163 c.ExpectPattern("250 *")
164 c.Writeln("RCPT TO:<to2@maddy.test>")
165 c.ExpectPattern("250 *")
166 c.Writeln("DATA")
167 c.ExpectPattern("354 *")
168 c.Writeln("From: <from@maddy.test>")
169 c.Writeln("To: <to@maddy.test>")
170 c.Writeln("Subject: Hello!")
171 c.Writeln("")
172 c.Writeln("Hello!")
173 c.Writeln(".")
174 c.ExpectPattern("250 2.0.0 OK: queued")
175 c.Writeln("QUIT")
176 c.ExpectPattern("221 *")
177
178 if be.SessionCounter != 1 {
179 t.Fatal("No actual connection made?", be.SessionCounter)
180 }
181}

Callers

nothing calls this directly

Calls 12

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

Tested by

no test coverage detected