diff options
Diffstat (limited to 'state_test.go')
| -rw-r--r-- | state_test.go | 19 |
1 files changed, 12 insertions, 7 deletions
diff --git a/state_test.go b/state_test.go index 082a93c..688057b 100644 --- a/state_test.go +++ b/state_test.go @@ -57,9 +57,14 @@ func loginOAuthSelenium(t *testing.T, url string, state *VPNState) { } } -func stateCallback(t *testing.T, oldState VPNStateID, newState VPNStateID, data string, state *VPNState) { +func stateCallback(t *testing.T, oldState VPNStateID, newState VPNStateID, data interface{}, state *VPNState) { if newState == fsm.OAUTH_STARTED { - loginOAuthSelenium(t, data, state) + url, ok := data.(string) + + if !ok { + t.Fatalf("data is not a string for OAuth URL") + } + loginOAuthSelenium(t, url, state) } } @@ -68,7 +73,7 @@ func Test_server(t *testing.T) { state := &VPNState{} ensureLocalWellKnown() - state.Register("org.eduvpn.app.linux", "configstest", func(old VPNStateID, new VPNStateID, data string) { + state.Register("org.eduvpn.app.linux", "configstest", func(old VPNStateID, new VPNStateID, data interface{}) { stateCallback(t, old, new, data, state) }, false) @@ -84,7 +89,7 @@ func test_connect_oauth_parameter(t *testing.T, parameters httpw.URLParameters, state := &VPNState{} configDirectory := "test_oauth_parameters" - state.Register("org.eduvpn.app.linux", configDirectory, func(oldState VPNStateID, newState VPNStateID, data string) { + state.Register("org.eduvpn.app.linux", configDirectory, func(oldState VPNStateID, newState VPNStateID, data interface{}) { if newState == fsm.OAUTH_STARTED { baseURL := "http://127.0.0.1:8000/callback" url, err := httpw.HTTPConstructURL(baseURL, parameters) @@ -153,7 +158,7 @@ func Test_token_expired(t *testing.T) { // Get a vpn state state := &VPNState{} - state.Register("org.eduvpn.app.linux", "configsexpired", func(old VPNStateID, new VPNStateID, data string) { + state.Register("org.eduvpn.app.linux", "configsexpired", func(old VPNStateID, new VPNStateID, data interface{}) { stateCallback(t, old, new, data, state) }, false) @@ -201,7 +206,7 @@ func Test_token_invalid(t *testing.T) { ensureLocalWellKnown() - state.Register("org.eduvpn.app.linux", "configsinvalid", func(old VPNStateID, new VPNStateID, data string) { + state.Register("org.eduvpn.app.linux", "configsinvalid", func(old VPNStateID, new VPNStateID, data interface{}) { stateCallback(t, old, new, data, state) }, false) @@ -251,7 +256,7 @@ func Test_invalid_profile_corrected(t *testing.T) { ensureLocalWellKnown() - state.Register("org.eduvpn.app.linux", "configscancelprofile", func(old VPNStateID, new VPNStateID, data string) { + state.Register("org.eduvpn.app.linux", "configscancelprofile", func(old VPNStateID, new VPNStateID, data interface{}) { stateCallback(t, old, new, data, state) }, false) |
