Skip to content

Commit

Permalink
Closes #469
Browse files Browse the repository at this point in the history
  • Loading branch information
subnetmarco committed Aug 12, 2015
1 parent ec28b83 commit e302901
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 7 deletions.
2 changes: 1 addition & 1 deletion kong/plugins/oauth2/api.lua
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ return {
end,

GET = function(self, dao_factory, helpers)
return helpers.responses.send_HTTP_OK(self.plugin)
return helpers.responses.send_HTTP_OK(self.credential)
end,

PATCH = function(self, dao_factory)
Expand Down
4 changes: 3 additions & 1 deletion spec/plugins/basicauth/api_spec.lua
Original file line number Diff line number Diff line change
Expand Up @@ -78,8 +78,10 @@ describe("Basic Auth Credentials API", function()
describe("GET", function()

it("should retrieve by id", function()
local _, status = http_client.get(BASE_URL..credential.id)
local response, status = http_client.get(BASE_URL..credential.id)
assert.equal(200, status)
local body = json.decode(response)
assert.equals(credential.id, body.id)
end)

end)
Expand Down
4 changes: 3 additions & 1 deletion spec/plugins/keyauth/api_spec.lua
Original file line number Diff line number Diff line change
Expand Up @@ -81,8 +81,10 @@ describe("Key Auth Credentials API", function()
describe("GET", function()

it("should retrieve by id", function()
local _, status = http_client.get(BASE_URL..credential.id)
local response, status = http_client.get(BASE_URL..credential.id)
assert.equal(200, status)
local body = json.decode(response)
assert.equals(credential.id, body.id)
end)

end)
Expand Down
10 changes: 6 additions & 4 deletions spec/plugins/oauth2/api_spec.lua
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ describe("OAuth 2 Credentials API", function()
teardown(function()
spec_helper.stop_kong()
end)

describe("/consumers/:consumer/oauth2/", function()

setup(function()
Expand Down Expand Up @@ -72,14 +72,16 @@ describe("OAuth 2 Credentials API", function()

end)
end)

describe("/consumers/:consumer/oauth2/:id", function()

describe("GET", function()

it("should retrieve by id", function()
local _, status = http_client.get(BASE_URL..credential.id)
local response, status = http_client.get(BASE_URL..credential.id)
assert.equal(200, status)
local body = json.decode(response)
assert.equals(credential.id, body.id)
end)

end)
Expand Down Expand Up @@ -117,6 +119,6 @@ describe("OAuth 2 Credentials API", function()
end)

end)

end)
end)

0 comments on commit e302901

Please sign in to comment.