From 281372eea66f0bcf2cacc0518323da6ea4469a5c Mon Sep 17 00:00:00 2001 From: jwijenbergh Date: Thu, 6 Oct 2022 13:28:07 +0200 Subject: OAuth: Use an available port instead of the hard-coded 8000 --- client_test.go | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'client_test.go') diff --git a/client_test.go b/client_test.go index 1c7211f..b52d61c 100644 --- a/client_test.go +++ b/client_test.go @@ -106,7 +106,16 @@ func test_connect_oauth_parameter( "en", func(oldState FSMStateID, newState FSMStateID, data interface{}) { if newState == STATE_OAUTH_STARTED { - baseURL := "http://127.0.0.1:8000/callback" + current, currentErr := state.Servers.GetCurrentServer() + if currentErr != nil { + t.Fatalf("No current server with error: %v", currentErr) + } + port, portErr := current.GetOAuth().GetListenerPort() + + if portErr != nil { + t.Fatalf("No port with error: %v", portErr) + } + baseURL := fmt.Sprintf("http://127.0.0.1:%d/callback", port) url, err := httpw.HTTPConstructURL(baseURL, parameters) if err != nil { t.Fatalf( -- cgit v1.2.3