diff --git a/models/models_test.go b/models/models_test.go index ec84a5b6..e69733ff 100644 --- a/models/models_test.go +++ b/models/models_test.go @@ -61,6 +61,40 @@ func (s *ModelsSuite) TestPostGroupNoTargets(c *check.C) { c.Assert(err, check.Equals, ErrNoTargetsSpecified) } +func (s *ModelsSuite) TestPostSMTP(c *check.C) { + smtp := SMTP{ + Name: "Test SMTP", + Host: "1.1.1.1:25", + FromAddress: "Foo Bar ", + UserId: 1, + } + err = PostSMTP(&smtp) + c.Assert(err, check.Equals, nil) + ss, err := GetSMTPs(1) + c.Assert(err, check.Equals, nil) + c.Assert(len(ss), check.Equals, 1) +} + +func (s *ModelsSuite) TestPostSMTPNoHost(c *check.C) { + smtp := SMTP{ + Name: "Test SMTP", + FromAddress: "Foo Bar ", + UserId: 1, + } + err = PostSMTP(&smtp) + c.Assert(err, check.Equals, ErrHostNotSpecified) +} + +func (s *ModelsSuite) TestPostSMTPNoFrom(c *check.C) { + smtp := SMTP{ + Name: "Test SMTP", + UserId: 1, + Host: "1.1.1.1:25", + } + err = PostSMTP(&smtp) + c.Assert(err, check.Equals, ErrFromAddressNotSpecified) +} + func (s *ModelsSuite) TestPutUser(c *check.C) { u, err := GetUser(1) u.Username = "admin_changed"