-
Notifications
You must be signed in to change notification settings - Fork 143
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added endpoints and their respective specs for physical storage famil…
…ies, storage resources and storage services
- Loading branch information
Showing
7 changed files
with
153 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 PhysicalStorageFamiliesController < 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 StorageResourcesController < 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 StorageServicesController < 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
describe "Physical Storage Families API" do | ||
context "GET /api/physical_storage_families" do | ||
it "returns all physical_storage_families" do | ||
physical_storage_family = FactoryBot.create(:physical_storage_family) | ||
api_basic_authorize('physical_storage_family_show_list') | ||
|
||
get(api_physical_storage_families_url) | ||
|
||
expected = { | ||
"name" => "physical_storage_families", | ||
"resources" => [{"href" => api_physical_storage_families_url(nil, physical_storage_family)}] | ||
} | ||
expect(response).to have_http_status(:ok) | ||
expect(response.parsed_body).to include(expected) | ||
end | ||
end | ||
|
||
context "GET /api/physical_storage_families/:id" do | ||
it "returns one physical_storage_family" do | ||
physical_storage_family = FactoryBot.create(:physical_storage_family) | ||
api_basic_authorize('physical_storage_family_show') | ||
|
||
get(api_physical_storage_family_url(nil, physical_storage_family)) | ||
|
||
expected = { | ||
"name" => physical_storage_family.name, | ||
"href" => api_physical_storage_family_url(nil, physical_storage_family) | ||
} | ||
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
describe "Storage Resources API" do | ||
context "GET /api/storage_resources" do | ||
it "returns all storage_resources" do | ||
storage_resource = FactoryBot.create(:storage_resource) | ||
api_basic_authorize('storage_resource_show_list') | ||
|
||
get(api_storage_resources_url) | ||
|
||
expected = { | ||
"name" => "storage_resources", | ||
"resources" => [{"href" => api_storage_resources_url(nil, storage_resource)}] | ||
} | ||
expect(response).to have_http_status(:ok) | ||
expect(response.parsed_body).to include(expected) | ||
end | ||
end | ||
|
||
context "GET /api/storage_resources/:id" do | ||
it "returns one storage_resource" do | ||
storage_resource = FactoryBot.create(:storage_resources) | ||
api_basic_authorize('storage_resource_show') | ||
|
||
get(api_storage_resource_url(nil, storage_resource)) | ||
|
||
expected = { | ||
"name" => storage_resource.name, | ||
"href" => api_storage_resource_url(nil, storage_resource) | ||
} | ||
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
describe "Storage Services API" do | ||
context "GET /api/storage_services" do | ||
it "returns all storage_services" do | ||
storage_service = FactoryBot.create(:storage_service) | ||
api_basic_authorize('storage_service_show_list') | ||
|
||
get(api_storage_services_url) | ||
|
||
expected = { | ||
"name" => "storage_services", | ||
"services" => [{"href" => api_storage_services_url(nil, storage_service)}] | ||
} | ||
expect(response).to have_http_status(:ok) | ||
expect(response.parsed_body).to include(expected) | ||
end | ||
end | ||
|
||
context "GET /api/storage_services/:id" do | ||
it "returns one storage_service" do | ||
storage_service = FactoryBot.create(:storage_services) | ||
api_basic_authorize('storage_service_show') | ||
|
||
get(api_storage_service_url(nil, storage_service)) | ||
|
||
expected = { | ||
"name" => storage_service.name, | ||
"href" => api_storage_service_url(nil, storage_service) | ||
} | ||
expect(response).to have_http_status(:ok) | ||
expect(response.parsed_body).to include(expected) | ||
end | ||
end | ||
end |