mirror of
https://github.com/volatiletech/authboss.git
synced 2025-01-24 05:17:10 +02:00
fa6ba517db
- Change response to be more central to Authboss. Make sure it has useful methods and works with the new rendering idioms. - Change the load user methods to all work with context keys, and even be able to set context keys on the current request to avoid setting contexts everywhere in the code base.
28 lines
557 B
Go
28 lines
557 B
Go
package authboss
|
|
|
|
import (
|
|
"testing"
|
|
|
|
"github.com/pkg/errors"
|
|
)
|
|
|
|
func TestClientDataErr(t *testing.T) {
|
|
t.Parallel()
|
|
|
|
estr := "Failed to retrieve client attribute: lol"
|
|
err := ClientDataErr{"lol"}
|
|
if str := err.Error(); str != estr {
|
|
t.Error("Error was wrong:", str)
|
|
}
|
|
}
|
|
|
|
func TestRenderErr(t *testing.T) {
|
|
t.Parallel()
|
|
|
|
estr := `error rendering response "lol": cause, data: authboss.HTMLData{"a":5}`
|
|
err := RenderErr{"lol", NewHTMLData("a", 5), errors.New("cause")}
|
|
if str := err.Error(); str != estr {
|
|
t.Error("Error was wrong:", str)
|
|
}
|
|
}
|