Skip to content

Commit

Permalink
add tests fro deprecation warning introduced for #196
Browse files Browse the repository at this point in the history
Signed-off-by: Stefan Bodewig <stefan.bodewig@innoq.com>
  • Loading branch information
bodewig authored and zandbelt committed Sep 17, 2018
1 parent 5ca77e3 commit 606ed33
Showing 1 changed file with 38 additions and 2 deletions.
40 changes: 38 additions & 2 deletions tests/spec/bearer_token_verification_spec.lua
Original file line number Diff line number Diff line change
Expand Up @@ -62,17 +62,33 @@ local function base_checks()
end)
end

describe("when using a statically configured RSA public key", function()
describe("when using a statically configured RSA public key using secret opt", function()
test_support.start_server({
verify_opts = {
secret = test_support.load("/spec/public_rsa_key.pem")
}
})
teardown(test_support.stop_server)
base_checks()
it("a deprecation warning is logged", function()
assert.error_log_contains("using deprecated option `opts.secret` for asymmetric key")
end)
end)

describe("when using a statically configured RSA public key using public_key opt", function()
test_support.start_server({
verify_opts = {
public_key = test_support.load("/spec/public_rsa_key.pem")
}
})
teardown(test_support.stop_server)
base_checks()
it("no deprecation warning is logged", function()
assert.is_not.error_log_contains("using deprecated option `opts.secret` for asymmetric key")
end)
end)

describe("when using a statically configured symmetric key for HMAC", function()
describe("when using a statically configured symmetric key for HMAC using secret opt", function()
test_support.start_server({
verify_opts = {
secret = "secret"
Expand All @@ -84,6 +100,26 @@ describe("when using a statically configured symmetric key for HMAC", function()
})
teardown(test_support.stop_server)
base_checks()
it("a deprecation warning is logged", function()
assert.error_log_contains("using deprecated option `opts.secret` for symmetric key")
end)
end)

describe("when using a statically configured symmetric key for HMAC using symmetric_key opt", function()
test_support.start_server({
verify_opts = {
symmetric_key = "secret"
},
jwt_sign_secret = "secret",
token_header = {
alg = "HS256",
}
})
teardown(test_support.stop_server)
base_checks()
it("no deprecation warning is logged", function()
assert.is_not.error_log_contains("using deprecated option `opts.secret` for symmetric key")
end)
end)

describe("when using a RSA key from a JWK that contains the x5c claim", function()
Expand Down

0 comments on commit 606ed33

Please sign in to comment.