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

	err := sw.Validate()

	c.Check(err, jc.Satisfies, errors.IsNotValid)
}
Exemple #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`)
}
Exemple #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`)
}
Exemple #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`)
}
Exemple #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)
}