-
Notifications
You must be signed in to change notification settings - Fork 141
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #19 from cfcosta/middleware-api-endpoints
Middleware API Endpoints
- Loading branch information
Showing
12 changed files
with
496 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 MiddlewareDatasourcesController < 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
module Api | ||
class MiddlewareDeploymentsController < 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
module Api | ||
class MiddlewareDomainsController < 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
module Api | ||
class MiddlewareMessagingsController < 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
module Api | ||
class MiddlewareServersController < 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,67 @@ | ||
describe 'Middleware Datasources API' do | ||
let(:datasource) { FactoryGirl.create(:middleware_datasource) } | ||
|
||
describe '/' do | ||
it 'forbids access without an appropriate role' do | ||
api_basic_authorize | ||
|
||
get api_middleware_datasources_url | ||
|
||
expect(response).to have_http_status(:forbidden) | ||
end | ||
|
||
it 'returns an empty listing of datasources' do | ||
api_basic_authorize collection_action_identifier(:middleware_datasources, :read, :get) | ||
|
||
get api_middleware_datasources_url | ||
|
||
expect(response).to have_http_status(:ok) | ||
expect(response.parsed_body).to include( | ||
'name' => 'middleware_datasources', | ||
'count' => 0, | ||
'resources' => [], | ||
'subcount' => 0 | ||
) | ||
end | ||
|
||
it 'returns a listing of datasources' do | ||
datasource | ||
|
||
api_basic_authorize collection_action_identifier(:middleware_datasources, :read, :get) | ||
|
||
get api_middleware_datasources_url | ||
|
||
expect(response).to have_http_status(:ok) | ||
expect(response.parsed_body).to include( | ||
'name' => 'middleware_datasources', | ||
'count' => 1, | ||
'resources' => [{ | ||
'href' => api_middleware_datasource_url(nil, datasource) | ||
}], | ||
'subcount' => 1 | ||
) | ||
end | ||
end | ||
|
||
describe '/:id' do | ||
it 'forbids access to a datasource without an appropriate role' do | ||
api_basic_authorize | ||
|
||
get api_middleware_datasource_url(nil, datasource) | ||
|
||
expect(response).to have_http_status(:forbidden) | ||
end | ||
|
||
it 'returns the attributes of one datasource' do | ||
api_basic_authorize action_identifier(:middleware_datasources, :read, :resource_actions, :get) | ||
|
||
get api_middleware_datasource_url(nil, datasource) | ||
|
||
expect(response).to have_http_status(:ok) | ||
expect(response.parsed_body).to include( | ||
'id' => datasource.id.to_s, | ||
'href' => api_middleware_datasource_url(nil, datasource) | ||
) | ||
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
describe 'Middleware Deployments API' do | ||
let(:deployment) { FactoryGirl.create(:middleware_deployment) } | ||
|
||
describe '/' do | ||
it 'forbids access without an appropriate role' do | ||
api_basic_authorize | ||
|
||
get api_middleware_deployments_url | ||
|
||
expect(response).to have_http_status(:forbidden) | ||
end | ||
|
||
it 'returns an empty listing of deployments' do | ||
api_basic_authorize collection_action_identifier(:middleware_deployments, :read, :get) | ||
|
||
get api_middleware_deployments_url | ||
|
||
expect(response).to have_http_status(:ok) | ||
expect(response.parsed_body).to include( | ||
'name' => 'middleware_deployments', | ||
'count' => 0, | ||
'resources' => [], | ||
'subcount' => 0 | ||
) | ||
end | ||
|
||
it 'returns a a listing of deployments' do | ||
deployment | ||
|
||
api_basic_authorize collection_action_identifier(:middleware_deployments, :read, :get) | ||
|
||
get api_middleware_deployments_url | ||
|
||
expect(response).to have_http_status(:ok) | ||
expect(response.parsed_body).to include( | ||
'name' => 'middleware_deployments', | ||
'count' => 1, | ||
'resources' => [{ | ||
'href' => api_middleware_deployment_url(nil, deployment) | ||
}], | ||
'subcount' => 1 | ||
) | ||
end | ||
end | ||
|
||
describe '/:id' do | ||
it 'forbids access to a deployment without an appropriate role' do | ||
api_basic_authorize | ||
|
||
get api_middleware_deployment_url(nil, deployment) | ||
|
||
expect(response).to have_http_status(:forbidden) | ||
end | ||
|
||
it 'returns the attributes of one deployment' do | ||
api_basic_authorize action_identifier(:middleware_deployments, :read, :resource_actions, :get) | ||
|
||
get api_middleware_deployment_url(nil, deployment) | ||
|
||
expect(response).to have_http_status(:ok) | ||
expect(response.parsed_body).to include( | ||
'id' => deployment.id.to_s, | ||
'ems_id' => deployment.ems_id.to_s, | ||
'href' => api_middleware_deployment_url(nil, deployment), | ||
'name' => deployment.name | ||
) | ||
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
describe 'Middleware Domains API' do | ||
let(:domain) { FactoryGirl.create :middleware_domain } | ||
|
||
describe '/' do | ||
it 'forbids access without an appropriate role' do | ||
api_basic_authorize | ||
|
||
get api_middleware_domains_url | ||
|
||
expect(response).to have_http_status(:forbidden) | ||
end | ||
|
||
it 'returns an empty listing of domains' do | ||
api_basic_authorize collection_action_identifier(:middleware_domains, :read, :get) | ||
|
||
get api_middleware_domains_url | ||
|
||
expect(response).to have_http_status(:ok) | ||
expect(response.parsed_body).to include( | ||
'name' => 'middleware_domains', | ||
'count' => 0, | ||
'resources' => [], | ||
'subcount' => 0 | ||
) | ||
end | ||
|
||
it 'returns a listing of domains' do | ||
domain | ||
|
||
api_basic_authorize collection_action_identifier(:middleware_domains, :read, :get) | ||
|
||
get api_middleware_domains_url | ||
|
||
expect(response).to have_http_status(:ok) | ||
expect(response.parsed_body).to include( | ||
'name' => 'middleware_domains', | ||
'count' => 1, | ||
'resources' => [{ | ||
'href' => api_middleware_domain_url(nil, domain) | ||
}], | ||
'subcount' => 1 | ||
) | ||
end | ||
end | ||
|
||
describe '/:id' do | ||
it 'forbids access to a domain without an appropriate role' do | ||
api_basic_authorize | ||
|
||
get api_middleware_domain_url(nil, domain) | ||
|
||
expect(response).to have_http_status(:forbidden) | ||
end | ||
|
||
it 'returns the attributes of one domain' do | ||
api_basic_authorize action_identifier(:middleware_domains, :read, :resource_actions, :get) | ||
|
||
get api_middleware_domain_url(nil, domain) | ||
|
||
expect(response).to have_http_status(:ok) | ||
expect(response.parsed_body).to include( | ||
'id' => domain.id.to_s, | ||
'href' => api_middleware_domain_url(nil, domain), | ||
'name' => domain.name | ||
) | ||
end | ||
end | ||
end |
Oops, something went wrong.