id is optional if already specified in header

This commit is contained in:
Sam
2016-09-02 17:08:46 +10:00
parent be0fd5b4cc
commit 1d281e02c7
2 changed files with 16 additions and 1 deletions

View File

@ -94,6 +94,17 @@ TXT
end
it "allows for a revoke with no id" do
key = Fabricate(:readonly_user_api_key)
request.env['HTTP_USER_API_KEY'] = key.key
post :revoke
expect(response.status).to eq(200)
key.reload
expect(key.revoked_at).not_to eq(nil)
end
it "will not allow readonly api keys to revoke others" do
key1 = Fabricate(:readonly_user_api_key)
key2 = Fabricate(:readonly_user_api_key)