Commit af9eb4dc authored by Timo Furrer's avatar Timo Furrer

Use schema to test resource access token list API

This change introduces a schema fixture to verify the response for the
list responses for Group and Project Access Tokens.

It also makes sure that the response contains the proper pagination
headers.
parent 5be27d66
{
"type": "array",
"items": { "$ref": "resource_access_token.json" }
}
...@@ -29,6 +29,8 @@ RSpec.describe API::ResourceAccessTokens do ...@@ -29,6 +29,8 @@ RSpec.describe API::ResourceAccessTokens do
token_ids = json_response.map { |token| token['id'] } token_ids = json_response.map { |token| token['id'] }
expect(response).to have_gitlab_http_status(:ok) expect(response).to have_gitlab_http_status(:ok)
expect(response).to include_pagination_headers
expect(response).to match_response_schema('public_api/v4/resource_access_tokens')
expect(token_ids).to match_array(access_tokens.pluck(:id)) expect(token_ids).to match_array(access_tokens.pluck(:id))
end end
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment