Skip to content

Commit

Permalink
Fix test failures introduced by #775
Browse files Browse the repository at this point in the history
  • Loading branch information
Tieske committed Dec 9, 2015
1 parent cbf94e9 commit 0488141
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions spec/plugins/oauth2/access_spec.lua
Original file line number Diff line number Diff line change
Expand Up @@ -690,21 +690,20 @@ describe("Authentication Plugin", function()
assert.are.equal(0, utils.table_size(body))
end)

it("should return 401 Unauthorized when a invalid access token is being sent via url parameter", function()
it("should return 401 Unauthorized when an invalid access token is being sent via url parameter", function()
local response, status, headers = http_client.get(STUB_GET_URL, { access_token = "invalid" }, {host = "oauth2.com"})
local body = cjson.decode(response)
assert.are.equal(401, status)
assert.are.equal('Bearer realm="service" error="invalid_token" error_description="The access token invalid"', headers['www-authenticate'])
assert.are.equal('Bearer realm="service" error="invalid_token" error_description="The access token is invalid"', headers['www-authenticate'])
assert.are.equal("invalid_token", body.error)
assert.are.equal("The access token invalid", body.error_description)
end)

it("should return 401 Unauthorized when a invalid access_token is being sent via the Authorization header", function()
local token = provision_token()
it("should return 401 Unauthorized when an invalid access token is being sent via the Authorization header", function()
local response, status, headers = http_client.post(STUB_POST_URL, { }, {host = "oauth2.com", authorization = "bearer invalid"})
local body = cjson.decode(response)
assert.are.equal(401, status)
assert.are.equal('Bearer realm="service" error="invalid_token" error_description="The access token invalid"', headers['www-authenticate'])
assert.are.equal('Bearer realm="service" error="invalid_token" error_description="The access token is invalid"', headers['www-authenticate'])
assert.are.equal("invalid_token", body.error)
assert.are.equal("The access token invalid", body.error_description)
end)
Expand Down

0 comments on commit 0488141

Please sign in to comment.