auth/internal/domain/user.go

37 lines
1.1 KiB
Go
Raw Normal View History

2021-12-29 20:08:03 +00:00
package domain
2022-01-08 10:53:58 +00:00
import (
"net/url"
2022-01-08 10:53:58 +00:00
"testing"
)
2021-12-29 20:08:03 +00:00
type User struct {
Me *Me
AuthorizationEndpoint *url.URL
IndieAuthMetadata *url.URL
Micropub *url.URL
Microsub *url.URL
TicketEndpoint *url.URL
TokenEndpoint *url.URL
2021-12-29 20:08:03 +00:00
*Profile
}
2022-01-29 17:50:45 +00:00
// TestUser returns valid random generated user for tests.
2021-12-29 20:08:03 +00:00
func TestUser(tb testing.TB) *User {
tb.Helper()
return &User{
Profile: TestProfile(tb),
Me: TestMe(tb, "https://user.example.net/"),
AuthorizationEndpoint: &url.URL{Scheme: "https", Host: "example.org", Path: "/auth"},
IndieAuthMetadata: &url.URL{
Scheme: "https", Host: "example.org",
Path: "/.well-known/oauth-authorization-server",
},
Micropub: &url.URL{Scheme: "https", Host: "microsub.example.org", Path: "/"},
Microsub: &url.URL{Scheme: "https", Host: "micropub.example.org", Path: "/"},
TicketEndpoint: &url.URL{Scheme: "https", Host: "example.org", Path: "/ticket"},
TokenEndpoint: &url.URL{Scheme: "https", Host: "example.org", Path: "/token"},
2021-12-29 20:08:03 +00:00
}
}