forked from ManageIQ/manageiq-api
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add support for /api/container_templates
- New collection - GETS and bulk query - supports custom_actions
- Loading branch information
Jillian Tullo
committed
Nov 21, 2017
1 parent
f80b70b
commit 19cf712
Showing
5 changed files
with
108 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
module Api | ||
class ContainerTemplatesController < BaseController | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
describe "Container Templates API" do | ||
context 'GET /api/container_templates' do | ||
it 'forbids access to container templates without an appropriate role' do | ||
api_basic_authorize | ||
|
||
get(api_container_templates_url) | ||
|
||
expect(response).to have_http_status(:forbidden) | ||
end | ||
|
||
it 'returns container templates with an appropriate role' do | ||
container_template = FactoryGirl.create(:container_template) | ||
api_basic_authorize(collection_action_identifier(:container_templates, :read, :get)) | ||
|
||
get(api_container_templates_url) | ||
|
||
expected = { | ||
'resources' => [{'href' => api_container_template_url(nil, container_template)}] | ||
} | ||
expect(response).to have_http_status(:ok) | ||
expect(response.parsed_body).to include(expected) | ||
end | ||
end | ||
|
||
context 'GET /api/container_templates' do | ||
let(:container_template) { FactoryGirl.create(:container_template) } | ||
|
||
it 'forbids access to a container template without an appropriate role' do | ||
api_basic_authorize | ||
|
||
get(api_container_template_url(nil, container_template)) | ||
|
||
expect(response).to have_http_status(:forbidden) | ||
end | ||
|
||
it 'returns the container template with an appropriate role' do | ||
api_basic_authorize(action_identifier(:container_templates, :read, :resource_actions, :get)) | ||
|
||
get(api_container_template_url(nil, container_template)) | ||
|
||
expected = { | ||
'href' => api_container_template_url(nil, container_template) | ||
} | ||
expect(response).to have_http_status(:ok) | ||
expect(response.parsed_body).to include(expected) | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters