mirror of
https://github.com/router-for-me/CLIProxyAPI.git
synced 2026-10-05 07:12:06 +08:00
- Accept optional metadata parameters in SDK and internal plugin host `StartLogin` methods. - Clone and pass metadata to the auth provider's `AuthLoginStartRequest`. - Convert management auth URL query parameters into metadata before initiating plugin login flows. Closes: #5760
21 lines
680 B
Go
21 lines
680 B
Go
package pluginhost
|
|
|
|
import (
|
|
"context"
|
|
"testing"
|
|
)
|
|
|
|
func TestHostStartLoginNilSafe(t *testing.T) {
|
|
var nilHost *Host
|
|
resp, handled, err := nilHost.StartLogin(context.Background(), "test", "http://example.com", map[string]any{"key": "val"})
|
|
if handled || err != nil || resp.State != "" {
|
|
t.Fatalf("StartLogin on nil host = (%#v, %v, %v), want zero values", resp, handled, err)
|
|
}
|
|
|
|
emptyHost := &Host{}
|
|
resp, handled, err = emptyHost.StartLogin(context.Background(), "test", "http://example.com", map[string]any{"key": "val"})
|
|
if handled || err != nil || resp.State != "" {
|
|
t.Fatalf("StartLogin on empty host = (%#v, %v, %v), want zero values", resp, handled, err)
|
|
}
|
|
}
|