Example #1
0
// NewServer builds a new empire.Empire instance and returns an httptest.Server
// running the empire API.
func NewServer(t testing.TB, e *empire.Empire) *httptest.Server {
	if e == nil {
		e = NewEmpire(t)
	}

	return httptest.NewServer(server.New(e, server.DefaultOptions))
}
Example #2
0
func newServer(c *cli.Context, e *empire.Empire) http.Handler {
	opts := server.Options{}
	opts.GitHub.ClientID = c.String(FlagGithubClient)
	opts.GitHub.ClientSecret = c.String(FlagGithubSecret)
	opts.GitHub.Organization = c.String(FlagGithubOrg)

	return server.New(e, opts)
}