Exemplo n.º 1
0
func (s *OriginTypeSuite) TestParseOriginTypeValid(c *gc.C) {
	tests := map[string]logfwd.OriginType{
		"unknown": logfwd.OriginTypeUnknown,
		"user":    logfwd.OriginTypeUser,
		"machine": logfwd.OriginTypeMachine,
		"unit":    logfwd.OriginTypeUnit,
	}
	for str, expected := range tests {
		c.Logf("trying %q", str)

		ot, err := logfwd.ParseOriginType(str)
		c.Assert(err, jc.ErrorIsNil)

		c.Check(ot, gc.Equals, expected)
	}
}
Exemplo n.º 2
0
func (s *OriginTypeSuite) TestParseOriginTypeInvalid(c *gc.C) {
	_, err := logfwd.ParseOriginType("spam")

	c.Check(err, gc.ErrorMatches, `unrecognized origin type "spam"`)
}
Exemplo n.º 3
0
func (s *OriginTypeSuite) TestParseOriginTypeEmpty(c *gc.C) {
	_, err := logfwd.ParseOriginType("")

	c.Check(err, gc.ErrorMatches, `unrecognized origin type ""`)
}