mirror of https://github.com/gophish/gophish
Added tests for SMTP
parent
d1de466cc9
commit
78203ad208
|
@ -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 <foo@example.com>",
|
||||
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 <foo@example.com>",
|
||||
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"
|
||||
|
|
Loading…
Reference in New Issue