Example #1
0
func (s *SoftwareSuite) TestValidateZeroValue(c *gc.C) {
	var sw logfwd.Software

	err := sw.Validate()

	c.Check(err, jc.Satisfies, errors.IsNotValid)
}
Example #2
0
func (s *SoftwareSuite) TestValidateEmptyVersion(c *gc.C) {
	sw := logfwd.Software{
		PrivateEnterpriseNumber: 28978,
		Name: "juju",
	}

	err := sw.Validate()

	c.Check(err, jc.Satisfies, errors.IsNotValid)
	c.Check(err, gc.ErrorMatches, `empty Version`)
}
Example #3
0
func (s *SoftwareSuite) TestValidateEmptyName(c *gc.C) {
	sw := logfwd.Software{
		PrivateEnterpriseNumber: 28978,
		Version:                 version.MustParse("2.0.1"),
	}

	err := sw.Validate()

	c.Check(err, jc.Satisfies, errors.IsNotValid)
	c.Check(err, gc.ErrorMatches, `empty Name`)
}
Example #4
0
func (s *SoftwareSuite) TestValidateEmptyPEN(c *gc.C) {
	sw := logfwd.Software{
		Name:    "juju",
		Version: version.MustParse("2.0.1"),
	}

	err := sw.Validate()

	c.Check(err, jc.Satisfies, errors.IsNotValid)
	c.Check(err, gc.ErrorMatches, `missing PrivateEnterpriseNumber`)
}
Example #5
0
func (s *SoftwareSuite) TestValidateFull(c *gc.C) {
	sw := logfwd.Software{
		PrivateEnterpriseNumber: 28978,
		Name:    "juju",
		Version: version.MustParse("2.0.1"),
	}

	err := sw.Validate()

	c.Check(err, jc.ErrorIsNil)
}