Skip to content

Commit

Permalink
chore: add tests for new ESMTP args parsing
Browse files Browse the repository at this point in the history
  • Loading branch information
d--j committed Oct 5, 2023
1 parent 6b84246 commit d824e79
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions session_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -354,6 +354,18 @@ func Test_milterSession_Process(t *testing.T) {
}
},
}, &wire.Message{wire.CodeMail, []byte{'<', 'r', '>', 0, 'A', '=', 'B', 0}}, cont, false},
{"mail esmtp multi", fields{
backend: &processTestMilter{},
check: func(t *testing.T, s *serverSession) {
p := s.backend.(*processTestMilter)
if p.from != "r" {
t.Errorf("expected r, got %q", p.from)
}
if p.fromEsmtp != "A=B C=D" {
t.Errorf("expected A=B C=D, got %q", p.fromEsmtp)
}
},
}, &wire.Message{wire.CodeMail, []byte{'<', 'r', '>', 0, 'A', '=', 'B', 0, 'C', '=', 'D', 0}}, cont, false},
{"mail err", fields{
backend: &processTestMilter{},
}, &wire.Message{wire.CodeMail, []byte{}}, nil, true},
Expand Down Expand Up @@ -381,6 +393,18 @@ func Test_milterSession_Process(t *testing.T) {
}
},
}, &wire.Message{wire.CodeRcpt, []byte{'<', 'r', '>', 0, 'A', '=', 'B', 0}}, cont, false},
{"rcpt esmtp multi", fields{
backend: &processTestMilter{},
check: func(t *testing.T, s *serverSession) {
p := s.backend.(*processTestMilter)
if p.rcptTo != "r" {
t.Errorf("expected r, got %q", p.rcptTo)
}
if p.rcptEsmtp != "A=B C=D" {
t.Errorf("expected A=B C=D, got %q", p.rcptEsmtp)
}
},
}, &wire.Message{wire.CodeRcpt, []byte{'<', 'r', '>', 0, 'A', '=', 'B', 0, 'C', '=', 'D', 0}}, cont, false},
{"rcpt err", fields{
backend: &processTestMilter{},
}, &wire.Message{wire.CodeRcpt, []byte{}}, nil, true},
Expand Down

0 comments on commit d824e79

Please sign in to comment.