Exemplo n.º 1
0
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"))
}
Exemplo n.º 2
0
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`)
}
Exemplo n.º 3
0
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")
}