tidy a bit

This commit is contained in:
tsmethurst 2021-03-25 20:09:48 +01:00
commit a9ca7f1d55

View file

@ -212,7 +212,7 @@ func (suite *AccountTestSuite) TestAPIInitialize() {
r, err := router.New(suite.config, log) r, err := router.New(suite.config, log)
if err != nil { if err != nil {
suite.FailNow(fmt.Sprintf("error mapping routes onto router: %s", err)) suite.FailNow(fmt.Sprintf("error creating router: %s", err))
} }
r.AttachMiddleware(func(c *gin.Context) { r.AttachMiddleware(func(c *gin.Context) {
@ -223,16 +223,22 @@ func (suite *AccountTestSuite) TestAPIInitialize() {
fmt.Println(account) fmt.Println(account)
return return
} }
c.Set(oauth.SessionAuthorizedAccount, account) c.Set(oauth.SessionAuthorizedAccount, account)
c.Set(oauth.SessionAuthorizedUser, suite.testUser.ID) c.Set(oauth.SessionAuthorizedUser, suite.testUser.ID)
}) })
acct := New(suite.config, suite.db, log) acct := New(suite.config, suite.db, log)
acct.Route(r) if err := acct.Route(r); err != nil {
suite.FailNow(fmt.Sprintf("error mapping routes onto router: %s", err))
}
r.Start() r.Start()
defer r.Stop(context.Background()) defer func() {
if err := r.Stop(context.Background()); err != nil {
panic(fmt.Errorf("error stopping router: %s", err))
}
}()
time.Sleep(10 * time.Second) time.Sleep(10 * time.Second)
} }