Beispiel #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"))
}
Beispiel #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`)
}
Beispiel #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")
}