-
Notifications
You must be signed in to change notification settings - Fork 897
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
050bc40
commit e7fd6a6
Showing
1 changed file
with
43 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,43 @@ | ||
# | ||
# REST API Request Tests - Cloud Volumes | ||
# | ||
# Regions primary collections: | ||
# /api/cloud_volumes | ||
# | ||
# Tests for: | ||
# GET /api/cloud_volumes/:id | ||
# | ||
|
||
describe "Cloud Volumes API" do | ||
it "forbids access to cloud volumes without an appropriate role" do | ||
api_basic_authorize | ||
|
||
run_get(cloud_volumes_url) | ||
|
||
expect(response).to have_http_status(:forbidden) | ||
end | ||
|
||
it "forbids access to a cloud volume resource without an appropriate role" do | ||
api_basic_authorize | ||
|
||
cloud_volume = FactoryGirl.create(:cloud_volume) | ||
|
||
run_get(cloud_volumes_url(cloud_volume.id)) | ||
|
||
expect(response).to have_http_status(:forbidden) | ||
end | ||
|
||
it "allows GETs of a cloud volume" do | ||
api_basic_authorize action_identifier(:cloud_volumes, :read, :resource_actions, :get) | ||
|
||
cloud_volume = FactoryGirl.create(:cloud_volume) | ||
|
||
run_get(cloud_volumes_url(cloud_volume.id)) | ||
|
||
expect(response).to have_http_status(:ok) | ||
expect(response.parsed_body).to include( | ||
"href" => a_string_matching(cloud_volumes_url(cloud_volume.id)), | ||
"id" => cloud_volume.id | ||
) | ||
end | ||
end |