Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions spec/policy/token_introspection/token_introspection_spec.lua
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ describe("token introspection policy", function()
it('success with valid token', function()
local introspection_url = "http://example/token/introspection"
local policy_config = {
client = test_backend,
introspection_url = introspection_url,
client_id = test_client_id,
client_secret = test_client_secret
Expand All @@ -52,13 +51,13 @@ describe("token introspection policy", function()
})
}
local token_policy = require('apicast.policy.token_introspection').new(policy_config)
token_policy.http_client.backend = test_backend
token_policy:access(context)
end)

it('failed with invalid token', function()
local introspection_url = "http://example/token/introspection"
local policy_config = {
client = test_backend,
introspection_url = introspection_url,
client_id = "client",
client_secret = "secret"
Expand All @@ -83,14 +82,14 @@ describe("token introspection policy", function()
stub(ngx, 'exit')

local token_policy = require('apicast.policy.token_introspection').new(policy_config)
token_policy.http_client.backend = test_backend
token_policy:access(context)
assert_authentication_failed()
end)

it('failed with bad status code', function()
local introspection_url = "http://example/token/introspection"
local policy_config = {
client = test_backend,
introspection_url = introspection_url,
client_id = "client",
client_secret = "secret"
Expand All @@ -112,14 +111,14 @@ describe("token introspection policy", function()
stub(ngx, 'exit')

local token_policy = require('apicast.policy.token_introspection').new(policy_config)
token_policy.http_client.backend = test_backend
token_policy:access(context)
assert_authentication_failed()
end)

it('failed with null response', function()
local introspection_url = "http://example/token/introspection"
local policy_config = {
client = test_backend,
introspection_url = introspection_url,
client_id = "client",
client_secret = "secret"
Expand All @@ -142,14 +141,14 @@ describe("token introspection policy", function()
stub(ngx, 'exit')

local token_policy = require('apicast.policy.token_introspection').new(policy_config)
token_policy.http_client.backend = test_backend
token_policy:access(context)
assert_authentication_failed()
end)

it('failed with bad contents type', function()
local introspection_url = "http://example/token/introspection"
local policy_config = {
client = test_backend,
introspection_url = introspection_url,
client_id = "client",
client_secret = "secret"
Expand All @@ -172,6 +171,7 @@ describe("token introspection policy", function()
stub(ngx, 'exit')

local token_policy = require('apicast.policy.token_introspection').new(policy_config)
token_policy.http_client.backend = test_backend
token_policy:access(context)
assert_authentication_failed()
end)
Expand Down