diff options
Diffstat (limited to 'state_test.go')
| -rw-r--r-- | state_test.go | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/state_test.go b/state_test.go index 6b05091..59b4f02 100644 --- a/state_test.go +++ b/state_test.go @@ -14,6 +14,14 @@ import ( "github.com/jwijenbergh/eduvpn-common/internal" ) +func ensureLocalWellKnown() { + wellKnown := os.Getenv("SERVER_IS_LOCAL") + + if wellKnown == "1" { + internal.WellKnownPath = "well-known.php" + } +} + func getServerURI(t *testing.T) string { serverURI := os.Getenv("SERVER_URI") if serverURI == "" { @@ -54,6 +62,7 @@ func stateCallback(t *testing.T, oldState string, newState string, data string, func Test_server(t *testing.T) { serverURI := getServerURI(t) state := &VPNState{} + ensureLocalWellKnown() state.Register("org.eduvpn.app.linux", "configstest", func(old string, new string, data string) { stateCallback(t, old, new, data, state) @@ -132,6 +141,8 @@ func Test_connect_oauth_parameters(t *testing.T) { {&failedCallbackStateMatchError, internal.URLParameters{"code": "42", "state": "21"}}, } + ensureLocalWellKnown() + for _, test := range tests { test_connect_oauth_parameter(t, test.parameters, test.expectedErr) } @@ -145,6 +156,8 @@ func Test_token_expired(t *testing.T) { return } + ensureLocalWellKnown() + // Convert the env variable to an int and signal error if it is not possible expiredInt, expiredErr := strconv.Atoi(expiredTTL) if expiredErr != nil { @@ -200,6 +213,8 @@ func Test_token_invalid(t *testing.T) { serverURI := getServerURI(t) state := &VPNState{} + ensureLocalWellKnown() + state.Register("org.eduvpn.app.linux", "configsinvalid", func(old string, new string, data string) { stateCallback(t, old, new, data, state) }, false) |
