-
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
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 - Regions | ||
# | ||
# Regions primary collections: | ||
# /api/regions | ||
# | ||
# Tests for: | ||
# GET /api/regions/:id | ||
# | ||
|
||
describe "Regions API" do | ||
it "forbids access to regions without an appropriate role" do | ||
api_basic_authorize | ||
|
||
run_get(regions_url) | ||
|
||
expect(response).to have_http_status(:forbidden) | ||
end | ||
|
||
it "forbids access to a region resource without an appropriate role" do | ||
api_basic_authorize | ||
|
||
region = FactoryGirl.create(:miq_region, :region => "2") | ||
|
||
run_get(regions_url(region.id)) | ||
|
||
expect(response).to have_http_status(:forbidden) | ||
end | ||
|
||
it "allows GETs of a region" do | ||
api_basic_authorize action_identifier(:regions, :read, :resource_actions, :get) | ||
|
||
region = FactoryGirl.create(:miq_region, :region => "2") | ||
|
||
run_get(regions_url(region.id)) | ||
|
||
expect(response).to have_http_status(:ok) | ||
expect(response.parsed_body).to include( | ||
"href" => a_string_matching(regions_url(region.id)), | ||
"id" => region.id | ||
) | ||
end | ||
end |