func (s *CommonSuite) TestAbsolutePath(c *gc.C) { ctx := testing.Context(c) err := user.WriteServerFile(s, ctx, "username", "password", "outfile.blah") c.Assert(err, jc.ErrorIsNil) c.Assert(filepath.IsAbs(s.serverFilename), jc.IsTrue) c.Assert(s.serverFilename, gc.Equals, filepath.Join(ctx.Dir, "outfile.blah")) }
func (s *CommonSuite) TestWriteServerFileBadUser(c *gc.C) { ctx := testing.Context(c) err := user.WriteServerFile(s, ctx, "bad user", "password", "outfile.blah") c.Assert(err, gc.ErrorMatches, `"bad user" is not a valid username`) }
func (s *CommonSuite) TestFileContent(c *gc.C) { ctx := testing.Context(c) err := user.WriteServerFile(s, ctx, "username", "password", "outfile.blah") c.Assert(err, jc.ErrorIsNil) s.assertServerFileMatches(c, s.serverFilename, "username", "password") }