Example #1
0
func (s *cmdSuite) TestDelete(c *gc.C) {
	in := bytes.NewBufferString("hello world")
	var out bytes.Buffer
	flags := map[string]interface{}{
		"url":  s.server.URL,
		"home": s.home,
	}
	// create
	c.Assert(cmd.NewNewCommand().Do(&StubContext{
		flags: flags,
		stdin: in, stdout: &out,
	}), gc.IsNil)
	// then delete
	c.Assert(cmd.NewDeleteCommand().Do(&StubContext{
		flags: flags,
		stdin: bytes.NewBuffer(out.Bytes()),
	}), gc.IsNil)
	// now it's gone
	c.Assert(cmd.NewFetchCommand().Do(&StubContext{
		flags: flags,
		stdin: bytes.NewBuffer(out.Bytes()),
	}), gc.ErrorMatches, `^404 Not Found.*`)
	c.Assert(cmd.NewDeleteCommand().Do(&StubContext{
		flags: flags,
		stdin: bytes.NewBuffer(out.Bytes()),
	}), gc.ErrorMatches, `^404 Not Found.*`)
}
Example #2
0
func main() {
	app := cli.NewApp()
	app.Name = "oo"
	app.Usage = "oo [command] [args]"
	app.Commands = []cli.Command{
		cmd.NewNewCommand().CLICommand(),
		cmd.NewFetchCommand().CLICommand(),
		cmd.NewCondCommand().CLICommand(),
		cmd.NewDeleteCommand().CLICommand(),
		cmd.NewKeyCommand().CLICommand(),
	}
	app.Run(os.Args)
}