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

Function TestLMTPClient_Is_Actually_LMTP

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

Source from the content-addressed store, hash-verified

86}
87
88func TestLMTPClient_Is_Actually_LMTP(tt *testing.T) {
89 t := tests.NewT(tt)
90 t.DNS(nil)
91 t.Port("smtp")
92 tgtPort := t.Port("target")
93 t.Config(`
94 hostname mx.maddy.test
95 tls off
96 smtp tcp://127.0.0.1:{env:TEST_PORT_smtp} {
97 deliver_to lmtp tcp://127.0.0.1:{env:TEST_PORT_target}
98 }`)
99 t.Run(1)
100 defer t.Close()
101
102 be, s := testutils.SMTPServer(tt, "127.0.0.1:"+strconv.Itoa(int(tgtPort)))
103 s.LMTP = true
104 be.LMTPDataErr = []error{nil, nil}
105 defer s.Close()
106
107 c := t.Conn("smtp")
108 defer c.Close()
109 c.SMTPNegotation("client.maddy.test", nil, nil)
110 c.Writeln("MAIL FROM:<from@maddy.test>")
111 c.ExpectPattern("250 *")
112 c.Writeln("RCPT TO:<to1@maddy.test>")
113 c.ExpectPattern("250 *")
114 c.Writeln("RCPT TO:<to2@maddy.test>")
115 c.ExpectPattern("250 *")
116 c.Writeln("DATA")
117 c.ExpectPattern("354 *")
118 c.Writeln("From: <from@maddy.test>")
119 c.Writeln("To: <to@maddy.test>")
120 c.Writeln("Subject: Hello!")
121 c.Writeln("")
122 c.Writeln("Hello!")
123 c.Writeln(".")
124 c.ExpectPattern("250 2.0.0 OK: queued")
125 c.Writeln("QUIT")
126 c.ExpectPattern("221 *")
127
128 if be.SessionCounter != 1 {
129 t.Fatal("No actual connection made?", be.SessionCounter)
130 }
131}
132
133func TestLMTPClient_Issue308(tt *testing.T) {
134 t := tests.NewT(tt)

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