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) } }
func (s *OriginTypeSuite) TestParseOriginTypeInvalid(c *gc.C) { _, err := logfwd.ParseOriginType("spam") c.Check(err, gc.ErrorMatches, `unrecognized origin type "spam"`) }
func (s *OriginTypeSuite) TestParseOriginTypeEmpty(c *gc.C) { _, err := logfwd.ParseOriginType("") c.Check(err, gc.ErrorMatches, `unrecognized origin type ""`) }