예제 #1
0
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
}
예제 #2
0
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)
	}
}
예제 #3
0
파일: add_test.go 프로젝트: howbazaar/lingo
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)
}
예제 #4
0
파일: add_test.go 프로젝트: howbazaar/lingo
func (s *cmdSuite) TestAddCMDNoURLFails(c *gc.C) {
	ctx := common.MockContext(c, "add")

	c.Assert(AddCMD.Run(ctx), jc.ErrorIsNil)
	c.Assert(s.stdErr.String(), gc.Equals, "error: expected 1 argument, got 0\n")
}