MailHog/mailhog/smtp/server/session_test.go

44 lines
990 B
Go
Raw Normal View History

2014-11-22 19:15:50 +00:00
package server
2014-04-28 00:42:05 +00:00
import (
"testing"
2014-11-22 19:15:50 +00:00
. "github.com/smartystreets/goconvey/convey"
2014-04-28 00:42:05 +00:00
)
func TestValidateAuthentication(t *testing.T) {
Convey("validateAuthentication is always successful", t, func() {
c := &Session{}
2014-04-28 00:42:05 +00:00
err, ok := c.validateAuthentication("OINK")
So(err, ShouldBeNil)
So(ok, ShouldBeTrue)
2014-04-28 00:42:05 +00:00
err, ok = c.validateAuthentication("OINK", "arg1")
So(err, ShouldBeNil)
So(ok, ShouldBeTrue)
2014-04-28 00:42:05 +00:00
err, ok = c.validateAuthentication("OINK", "arg1", "arg2")
So(err, ShouldBeNil)
So(ok, ShouldBeTrue)
})
2014-04-28 00:42:05 +00:00
}
func TestValidateRecipient(t *testing.T) {
Convey("validateRecipient is always successful", t, func() {
c := &Session{}
2014-04-28 00:42:05 +00:00
So(c.validateRecipient("OINK"), ShouldBeTrue)
So(c.validateRecipient("foo@bar.mailhog"), ShouldBeTrue)
})
}
2014-04-28 00:42:05 +00:00
func TestValidateSender(t *testing.T) {
Convey("validateSender is always successful", t, func() {
c := &Session{}
2014-04-28 00:42:05 +00:00
So(c.validateSender("OINK"), ShouldBeTrue)
So(c.validateSender("foo@bar.mailhog"), ShouldBeTrue)
})
2014-04-28 00:42:05 +00:00
}