func (s *FileVarSuite) TestReadNotStdin(c *gc.C) { var config cmd.FileVar config.Set("-") _, err := config.Read(s.ctx) c.Check(err, jc.Satisfies, os.IsNotExist) }
func (s *FileVarSuite) TestReadStdin(c *gc.C) { s.ctx.Stdin = bytes.NewBufferString("abc") var config cmd.FileVar config.SetStdin() config.Set("-") file, err := config.Read(s.ctx) c.Assert(err, gc.IsNil) c.Assert(string(file), gc.Equals, "abc") }
func (s *FileVarSuite) TestReadTilde(c *gc.C) { path := filepath.Join(utils.Home(), "config.yaml") err := ioutil.WriteFile(path, []byte("abc"), 0644) c.Assert(err, gc.IsNil) var config cmd.FileVar config.Set("~/config.yaml") file, err := config.Read(s.ctx) c.Assert(err, gc.IsNil) c.Assert(string(file), gc.Equals, "abc") }