Skip to content

Commit

Permalink
fix: add test
Browse files Browse the repository at this point in the history
  • Loading branch information
Han-Ya-Jun committed Dec 25, 2023
1 parent 53f0f54 commit 3dd5289
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions src/apisix/tests/bk-components/test-bkauth.lua
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ describe(
local result, err = bkauth.verify_app_secret("fake-app-code", "fake-app-secret")
assert.is_nil(result)
assert.is_true(core.string.has_prefix(err, "failed to request third-party api"))
assert.is_true(core.string.has_prefix(err, "request_id"))
end
)

Expand All @@ -79,6 +80,7 @@ describe(
assert.is_false(result.existed)
assert.is_false(result.verified)
assert.is_nil(err)
assert.is_true(core.string.has_prefix(err, "request_id"))
end
)

Expand All @@ -93,6 +95,7 @@ describe(
local result, err = bkauth.verify_app_secret("fake-app-code", "fake-app-secret")
assert.is_nil(result)
assert.is_true(core.string.has_prefix(err, "failed to request third-party api"))
assert.is_true(core.string.has_prefix(err, "request_id"))
end
)

Expand All @@ -115,6 +118,7 @@ describe(
local result, err = bkauth.verify_app_secret("fake-app-code", "fake-app-secret")
assert.is_nil(result)
assert.is_true(core.string.has_prefix(err, "failed to request third-party api"))
assert.is_true(core.string.has_prefix(err, "request_id"))
end
)

Expand Down Expand Up @@ -174,6 +178,7 @@ describe(
local result, err = bkauth.list_app_secrets("fake-app-code")
assert.is_nil(result)
assert.is_true(core.string.has_prefix(err, "failed to request third-party api"))
assert.is_true(core.string.has_prefix(err, "request_id"))
end
)
it(
Expand All @@ -196,6 +201,7 @@ describe(
}
)
assert.is_nil(err)
assert.is_true(core.string.has_prefix(err, "request_id"))
end
)

Expand All @@ -210,6 +216,7 @@ describe(
local result, err = bkauth.list_app_secrets("fake-app-code")
assert.is_nil(result)
assert.is_true(core.string.has_prefix(err, "failed to request third-party api"))
assert.is_true(core.string.has_prefix(err, "request_id"))
end
)

Expand All @@ -232,6 +239,7 @@ describe(
local result, err = bkauth.list_app_secrets("fake-app-code")
assert.is_nil(result)
assert.is_true(core.string.has_prefix(err, "failed to request third-party api"))
assert.is_true(core.string.has_prefix(err, "request_id"))
end
)

Expand Down Expand Up @@ -295,6 +303,7 @@ describe(
local result, err = bkauth.verify_access_token("fake-token")
assert.is_nil(result)
assert.is_true(core.string.has_prefix(err, "failed to request third-party api"))
assert.is_true(core.string.has_prefix(err, "request_id"))
end
)

Expand All @@ -309,6 +318,7 @@ describe(
local result, err = bkauth.verify_access_token("fake-token")
assert.is_nil(result)
assert.is_true(core.string.has_prefix(err, "failed to request third-party api"))
assert.is_true(core.string.has_prefix(err, "request_id"))
end
)

Expand Down Expand Up @@ -347,6 +357,7 @@ describe(
local result, err = bkauth.verify_access_token("fake-token")
assert.is_nil(result)
assert.is_true(core.string.has_prefix(err, "bkauth error message: error"))
assert.is_true(core.string.has_prefix(err, "request_id"))
end
)

Expand Down

0 comments on commit 3dd5289

Please sign in to comment.