From 723ecacc8528be0e96db42392f1781ddf5894bea Mon Sep 17 00:00:00 2001 From: Jeroen Wijenbergh Date: Tue, 19 Apr 2022 15:02:45 +0200 Subject: Profiles: Implement basic functionality for sending a profile_id --- src/server_test.go | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) (limited to 'src/server_test.go') diff --git a/src/server_test.go b/src/server_test.go index f914583..5b6ec5a 100644 --- a/src/server_test.go +++ b/src/server_test.go @@ -35,10 +35,13 @@ func LoginOAuthSelenium(t *testing.T, url string) { } } -func StateCallback(t *testing.T, oldState string, newState string, data string) { +func StateCallback(t *testing.T, oldState string, newState string, data string) string { if newState == "OAuth_Started" { go LoginOAuthSelenium(t, data) } + + // We have no data to send back + return "" } func Test_server(t *testing.T) { @@ -47,8 +50,8 @@ func Test_server(t *testing.T) { // Do not verify because during testing, the cert is self-signed http.DefaultTransport.(*http.Transport).TLSClientConfig = &tls.Config{InsecureSkipVerify: true} - state.Register("org.eduvpn.app.linux", "configstest", func(old string, new string, data string) { - StateCallback(t, old, new, data) + state.Register("org.eduvpn.app.linux", "configstest", func(old string, new string, data string) string { + return StateCallback(t, old, new, data) }, false) _, configErr := state.Connect("https://eduvpnserver") @@ -65,7 +68,7 @@ func test_connect_oauth_parameter(t *testing.T, parameters URLParameters, expect // Do not verify because during testing, the cert is self-signed http.DefaultTransport.(*http.Transport).TLSClientConfig = &tls.Config{InsecureSkipVerify: true} - state.Register("org.eduvpn.app.linux", "configsnologin", func(oldState string, newState string, data string) { + state.Register("org.eduvpn.app.linux", "configsnologin", func(oldState string, newState string, data string) string { if newState == "OAuth_Started" { baseURL := "http://127.0.0.1:8000/callback" url, err := HTTPConstructURL(baseURL, parameters) @@ -73,7 +76,10 @@ func test_connect_oauth_parameter(t *testing.T, parameters URLParameters, expect t.Errorf("Error: Constructing url %s with parameters %s", baseURL, fmt.Sprint(parameters)) } go http.Get(url) + } + // We have no data to send back + return "" }, false) _, configErr := state.Connect("https://eduvpnserver") @@ -123,8 +129,8 @@ func Test_token_expired(t *testing.T) { // Do not verify because during testing, the cert is self-signed http.DefaultTransport.(*http.Transport).TLSClientConfig = &tls.Config{InsecureSkipVerify: true} - state.Register("org.eduvpn.app.linux", "configsexpired", func(old string, new string, data string) { - StateCallback(t, old, new, data) + state.Register("org.eduvpn.app.linux", "configsexpired", func(old string, new string, data string) string { + return StateCallback(t, old, new, data) }, false) -- cgit v1.2.3