Add TestController (#50)

This can be used in tests to get access to a controller that behaves
just like a dev controller but doesn't require the normal Command bits
(UI, etc).

This can be enhanced over time as needed; for now it's pretty simple but
it's good enough to be used for API tests. A simple project create/read
API test is added as well, which serves to show the programmatic model
(as well as test those functions at the API level).
This commit is contained in:
Jeff Mitchell authored and GitHub committed 2020-05-15 10:19:55 -04:00
1 parent 2aca5fff03
commit f8b456f3a7
13 files changed
+306 -32

No files matched your search

@@ -259,7 +259,11 @@ func (c *Command) Run(args []string) int {
c.ShutdownFuncs = append(c.ShutdownFuncs, c.DestroyDevDatabase)
}
defer c.RunShutdownFuncs(c.UI)
defer func() {
if err := c.RunShutdownFuncs(); err != nil {
c.UI.Error(fmt.Errorf("Error running shutdown tasks: %w", err).Error())
}
}()
c.PrintInfo(c.UI, "controller")
c.ReleaseLogGate()