File tree Expand file tree Collapse file tree 1 file changed +17
-3
lines changed
Expand file tree Collapse file tree 1 file changed +17
-3
lines changed Original file line number Diff line number Diff line change @@ -626,6 +626,7 @@ func TestAPIHostResolver_AuthorizationServerURL(t *testing.T) {
626626 tests := []struct {
627627 name string
628628 host string
629+ oauthConfig * Config
629630 expectedURL string
630631 expectedError bool
631632 expectedStatusCode int
@@ -669,6 +670,15 @@ func TestAPIHostResolver_AuthorizationServerURL(t *testing.T) {
669670 expectedURL : "http://ghe.example.com/login/oauth" ,
670671 expectedStatusCode : http .StatusOK ,
671672 },
673+ {
674+ name : "custom authorization server in config takes precedence" ,
675+ host : "https://github.com" ,
676+ oauthConfig : & Config {
677+ AuthorizationServer : "https://custom.auth.example.com/oauth" ,
678+ },
679+ expectedURL : "https://custom.auth.example.com/oauth" ,
680+ expectedStatusCode : http .StatusOK ,
681+ },
672682 }
673683
674684 for _ , tc := range tests {
@@ -685,9 +695,13 @@ func TestAPIHostResolver_AuthorizationServerURL(t *testing.T) {
685695 }
686696 require .NoError (t , err )
687697
688- handler , err := NewAuthHandler (& Config {
689- BaseURL : "https://api.example.com" ,
690- }, apiHost )
698+ config := tc .oauthConfig
699+ if config == nil {
700+ config = & Config {}
701+ }
702+ config .BaseURL = tc .host
703+
704+ handler , err := NewAuthHandler (config , apiHost )
691705 require .NoError (t , err )
692706
693707 router := chi .NewRouter ()
You can’t perform that action at this time.
0 commit comments