(tt *testing.T)
| 86 | } |
| 87 | |
| 88 | func 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 | |
| 133 | func TestLMTPClient_Issue308(tt *testing.T) { |
| 134 | t := tests.NewT(tt) |
nothing calls this directly
no test coverage detected