forked from pereiro/smtprelay
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathstatus_test.go
31 lines (28 loc) · 931 Bytes
/
status_test.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
package main
import (
"reflect"
"smtprelay/smtpd"
"testing"
)
func TestParseOutcomingError(t *testing.T) {
output := ParseOutcomingError("450 TEST 123")
input := smtpd.Error{Code: 450, Message: "TEST 123"}
if !reflect.DeepEqual(input, output) {
t.Errorf("expect '%s', got - '%s'", input.Error(), output.Error())
}
output = ParseOutcomingError("450")
input = smtpd.Error{Code: 450, Message: ""}
if !reflect.DeepEqual(input, output) {
t.Errorf("expect '%s', got - '%s'", input.Error(), output.Error())
}
output = ParseOutcomingError("12")
input = ErrMessageErrorUnknown
if !reflect.DeepEqual(input, output) {
t.Errorf("expect '%s', got - '%s'", input.Error(), output.Error())
}
output = ParseOutcomingError("relay access denied")
input = smtpd.Error{Code: 450, Message: "relay access denied"}
if !reflect.DeepEqual(input, output) {
t.Errorf("expect '%s', got - '%s'", input.Error(), output.Error())
}
}