Issue 1359 fleetctl team transfer (#1413)

* wip

* Add delete user command and translator

* Add host transfer command

* Add changes file

* Undo bad refactor

* Fix copypaste error

* Implement with interfaces instead of assertions

* Ad documentation and simplify implementation further

* Update docs/1-Using-Fleet/3-REST-API.md

Co-authored-by: Zach Wasserman <zach@fleetdm.com>

Co-authored-by: Zach Wasserman <zach@fleetdm.com>
This commit is contained in:
Tomas Touceda
2021-07-21 14:03:10 -03:00
committed by GitHub
co-authored by Zach Wasserman
parent 567f43d4a3
commit 484c6153e3
17 changed files with 703 additions and 3 deletions
+14 -3
View File
@@ -50,6 +50,19 @@ func runServerWithMockedDS(t *testing.T, opts ...service.TestServerOpts) (*httpt
}
func runAppForTest(t *testing.T, args []string) string {
w, exitErr, err := runAppNoChecks(args)
require.Nil(t, err)
require.Nil(t, exitErr)
return w.String()
}
func runAppCheckErr(t *testing.T, args []string, errorMsg string) string {
w, _, err := runAppNoChecks(args)
require.Equal(t, errorMsg, err.Error())
return w.String()
}
func runAppNoChecks(args []string) (*bytes.Buffer, error, error) {
w := new(bytes.Buffer)
r, _, _ := os.Pipe()
var exitErr error
@@ -57,7 +70,5 @@ func runAppForTest(t *testing.T, args []string) string {
exitErr = err
})
err := app.Run(append([]string{""}, args...))
require.Nil(t, err)
require.Nil(t, exitErr)
return w.String()
return w, exitErr, err
}