summaryrefslogtreecommitdiff
path: root/state_test.go
diff options
context:
space:
mode:
authorjwijenbergh <jeroenwijenbergh@protonmail.com>2022-09-07 17:44:07 +0200
committerjwijenbergh <jeroenwijenbergh@protonmail.com>2022-09-07 17:44:07 +0200
commite1bd5ec1c939f5431925ab3bb83352d0a275ebd9 (patch)
tree5272a8592b52757ca288e20a759c244ecb962a3b /state_test.go
parent9be031fda160f7bb8e3294ab6620a1510828bd97 (diff)
Refactor: Remove the usage of the FSM in other internal packages
This removes the FSM from being imported and thus used in other internal packages such as `oauth` or `server`. The benefit is that it becomes much easier now to reason about the FSM as it's only used in the public package. Additionally, we do not have to re-initialize the server and the oauth structure with the FSM pointer.
Diffstat (limited to 'state_test.go')
-rw-r--r--state_test.go12
1 files changed, 3 insertions, 9 deletions
diff --git a/state_test.go b/state_test.go
index 20a7064..2106f40 100644
--- a/state_test.go
+++ b/state_test.go
@@ -123,7 +123,6 @@ func test_connect_oauth_parameter(
)
}
go http.Get(url)
-
}
},
false,
@@ -216,10 +215,10 @@ func Test_token_expired(t *testing.T) {
// Wait for TTL so that the tokens expire
time.Sleep(time.Duration(expiredInt) * time.Second)
- infoErr := server.APIInfo(currentServer)
+ _, _, configErr = state.GetConfigCustomServer(serverURI, false)
- if infoErr != nil {
- t.Fatalf("Info error after expired: %v", infoErr)
+ if configErr != nil {
+ t.Fatalf("Connect error after expiry: %v", configErr)
}
// Check if tokens have changed
@@ -256,11 +255,6 @@ func Test_token_invalid(t *testing.T) {
t.Fatalf("Connect error before invalid: %v", configErr)
}
- // Go to request_config so we can re-authorize
- // This is needed as the only actual authenticated requests we do in request_config (for profiles) and /connect
- // /disconnect is best effort so this does not need re-auth
- state.FSM.GoTransition(fsm.REQUEST_CONFIG)
-
dummy_value := "37"
currentServer, serverErr := state.Servers.GetCurrentServer()