func (*cmdSuite) TestWhichCMD(c *gc.C) { cfgPath, closer := common.TestCfg(c) defer closer() ctx := common.MockContext(c, common.TenetCfgFlg.LongArg(), cfgPath, "which") c.Assert(WhichCMD.Run(ctx), jc.ErrorIsNil) // TODO(waigani) test stdout, regex match: ^/home/[^/]*/\.lingo/tenet\.toml }
func (s *cmdSuite) TestRemoveCMD(c *gc.C) { cfgPath, closer := common.TestCfg(c) defer closer() tenetToRemove := common.TenetConfig{Name: "lingo-reviews/license"} ctx := common.MockContext(c, common.TenetCfgFlg.LongArg(), cfgPath, "remove", tenetToRemove.Name) c.Assert(RemoveCMD.Run(ctx), jc.ErrorIsNil) obtained, err := common.ReadConfigFile(cfgPath) c.Assert(err, jc.ErrorIsNil) for _, t := range obtained.AllTenets() { c.Assert(t.Name, gc.Not(gc.Equals), tenetToRemove.Name) } }
func (*cmdSuite) TestAddCMD(c *gc.C) { fName, closer := common.TestCfg(c) defer closer() // TODO(waigani) test all defaults and explicitly setting the driver. driver := "binary" c.Assert(defaultDriver(), gc.Equals, driver) newTenet := common.TenetConfig{ Name: "waigani/test", Driver: driver, Options: make(map[string]interface{}), } ctx := common.MockContext(c, common.TenetCfgFlg.LongArg(), fName, "add", newTenet.Name) orig, err := common.ReadConfigFile(fName) c.Assert(err, jc.ErrorIsNil) c.Assert(AddCMD.Run(ctx), jc.ErrorIsNil) obtained, err := common.ReadConfigFile(fName) c.Assert(err, jc.ErrorIsNil) expected := append(orig.AllTenets(), newTenet) c.Assert(obtained.AllTenets(), gc.DeepEquals, expected) }