Refactor: migrate discordbot
All checks were successful
Go test / run-go-vet (push) Successful in 20s
Go test / check-swagger-up-to-date (push) Successful in 9s
Go test / run-go-test (push) Successful in 47s
Go test / cleanup-go-test (push) Successful in 4s
Go test / release-image (push) Successful in 3m35s

This commit is contained in:
2025-12-13 02:03:01 +08:00
parent 0fc8f1f08c
commit 47f09b733a
23 changed files with 613 additions and 66 deletions

View File

@@ -18,7 +18,7 @@ func Test_01_Login(t *testing.T) {
t.Run("check preshared key failed", func(t *testing.T) {
resp, err := client.R().
SetBody(`{"userId": "testuser1"}`).
Post("/auth/gen-login-url")
Post("/bot/auth/gen-login-url")
if err != nil {
t.Fatal("request failed")
}
@@ -32,7 +32,7 @@ func Test_01_Login(t *testing.T) {
SetBody(`{"userId": "testuser1"}`).
SetAuthToken("poop").
SetResult(&payload).
Post("/auth/gen-login-url")
Post("/bot/auth/gen-login-url")
if err != nil || resp.StatusCode() != http.StatusOK {
t.Fatal("failed to get login url")
@@ -46,7 +46,8 @@ func Test_01_Login(t *testing.T) {
resp, err = client.R().
SetBody(loginPayload{Token: loginUrl.Query().Get("token")}).
Post(loginUrl.Scheme + "://" + loginUrl.Host + "/auth/login")
SetAuthToken("poop").
Post("/auth/login")
if err != nil || resp.StatusCode() != http.StatusOK {
t.Fatal("failed to login")
}

View File

@@ -15,7 +15,7 @@ var aliases []aliasPayload
func Test_04_GetAliases(t *testing.T) {
resp, err := client.R().
SetResult(&aliases).
Get("http://localhost:8080/api/aliases")
Get("/api/aliases")
if err != nil || resp.StatusCode() != http.StatusOK {
t.Logf("%+v", resp)
t.Fatal("failed to get aliases")