♻️ Updated Me domain usage
* Updated TestMe for use custom url as in TestURL * Use Me as Ticket Subject
This commit is contained in:
parent
6aad8f8ee9
commit
4ce47440aa
|
@ -101,10 +101,10 @@ func NewMe(raw string) (*Me, error) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// TestMe returns a valid random generated Me for tests.
|
// TestMe returns a valid random generated Me for tests.
|
||||||
func TestMe(tb testing.TB) *Me {
|
func TestMe(tb testing.TB, src string) *Me {
|
||||||
tb.Helper()
|
tb.Helper()
|
||||||
|
|
||||||
me, err := NewMe("https://user.example.net/")
|
me, err := NewMe(src)
|
||||||
require.NoError(tb, err)
|
require.NoError(tb, err)
|
||||||
|
|
||||||
return me
|
return me
|
||||||
|
|
|
@ -17,7 +17,7 @@ func TestSession(tb testing.TB) *Session {
|
||||||
|
|
||||||
return &Session{
|
return &Session{
|
||||||
ClientID: TestClientID(tb),
|
ClientID: TestClientID(tb),
|
||||||
Me: TestMe(tb),
|
Me: TestMe(tb, "https://user.example.net/"),
|
||||||
RedirectURI: TestURL(tb, "https://example.com/callback"),
|
RedirectURI: TestURL(tb, "https://example.com/callback"),
|
||||||
CodeChallengeMethod: CodeChallengeMethodPLAIN,
|
CodeChallengeMethod: CodeChallengeMethodPLAIN,
|
||||||
Scope: Scopes{ScopeProfile, ScopeEmail},
|
Scope: Scopes{ScopeProfile, ScopeEmail},
|
||||||
|
|
|
@ -12,7 +12,7 @@ type Ticket struct {
|
||||||
Resource *URL
|
Resource *URL
|
||||||
|
|
||||||
// The access token should be used when acting on behalf of this URL.
|
// The access token should be used when acting on behalf of this URL.
|
||||||
Subject *URL
|
Subject *Me
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestTicket(tb testing.TB) *Ticket {
|
func TestTicket(tb testing.TB) *Ticket {
|
||||||
|
@ -20,7 +20,7 @@ func TestTicket(tb testing.TB) *Ticket {
|
||||||
|
|
||||||
return &Ticket{
|
return &Ticket{
|
||||||
Resource: TestURL(tb, "https://alice.example.com/private/"),
|
Resource: TestURL(tb, "https://alice.example.com/private/"),
|
||||||
Subject: TestURL(tb, "https://bob.example.com/"),
|
Subject: TestMe(tb, "https://bob.example.com/"),
|
||||||
Ticket: "32985723984723985792834",
|
Ticket: "32985723984723985792834",
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -88,7 +88,7 @@ func TestToken(tb testing.TB) *Token {
|
||||||
|
|
||||||
t := jwt.New()
|
t := jwt.New()
|
||||||
cid := TestClientID(tb)
|
cid := TestClientID(tb)
|
||||||
me := TestMe(tb)
|
me := TestMe(tb, "https://user.example.net/")
|
||||||
now := time.Now().UTC().Round(time.Second)
|
now := time.Now().UTC().Round(time.Second)
|
||||||
scope := Scopes{
|
scope := Scopes{
|
||||||
ScopeCreate,
|
ScopeCreate,
|
||||||
|
|
|
@ -19,7 +19,7 @@ func TestUser(tb testing.TB) *User {
|
||||||
tb.Helper()
|
tb.Helper()
|
||||||
|
|
||||||
return &User{
|
return &User{
|
||||||
Me: TestMe(tb),
|
Me: TestMe(tb, "https://user.example.net/"),
|
||||||
Profile: TestProfile(tb),
|
Profile: TestProfile(tb),
|
||||||
AuthorizationEndpoint: TestURL(tb, "https://example.org/auth"),
|
AuthorizationEndpoint: TestURL(tb, "https://example.org/auth"),
|
||||||
IndieAuthMetadata: TestURL(tb, "https://example.org/.well-known/oauth-authorization-server"),
|
IndieAuthMetadata: TestURL(tb, "https://example.org/.well-known/oauth-authorization-server"),
|
||||||
|
|
Loading…
Reference in New Issue