Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tests cloud_networks with RBAC filtering from super #394

Merged
merged 1 commit into from
Mar 9, 2018
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
include Spec::Support::WorkflowHelper

let(:admin) { FactoryGirl.create(:user_with_group) }

let(:ems) { FactoryGirl.create(:ems_amazon) }
let(:template) { FactoryGirl.create(:template_amazon, :name => "template", :ext_management_system => ems) }
let(:workflow) do
Expand Down Expand Up @@ -166,6 +167,48 @@
end
end

context "tenant filtering" do
before do
@ct1 = FactoryGirl.create(:cloud_tenant)
@ct2 = FactoryGirl.create(:cloud_tenant)
end

context "cloud networks" do
before do
@az1 = FactoryGirl.create(:availability_zone, :ext_management_system => ems)
@cn1 = FactoryGirl.create(:cloud_network_amazon,
:cloud_tenant => @ct1,
:ext_management_system => ems.network_manager)
@cn2 = FactoryGirl.create(:cloud_network_amazon,
:cloud_tenant => @ct2,
:ext_management_system => ems.network_manager)
@cn3 = FactoryGirl.create(:cloud_network_amazon,
:cloud_tenant => @ct2,
:ext_management_system => ems.network_manager)
@cs1 = FactoryGirl.create(:cloud_subnet_amazon,
:cloud_network => @cn2,
:availability_zone => @az1,
:ext_management_system => ems.network_manager)
@cs2 = FactoryGirl.create(:cloud_subnet_amazon,
:cloud_network => @cn3,
:availability_zone => @az1,
:ext_management_system => ems.network_manager)
end

it "#allowed_cloud_networks with zone" do
workflow.values[:placement_availability_zone] = [@az1.id, @az1.name]
workflow.values[:cloud_tenant] = @ct2.id
cns = workflow.allowed_cloud_networks
expect(cns.keys).to match_array [@cn2.id, @cn3.id]
end

it "#allowed_cloud_networks without availability zone returns everything" do
cns = workflow.allowed_cloud_networks
expect(cns.keys).to match_array [@cn1.id, @cn2.id, @cn3.id]
end
end
end

context "when a template object is returned from the provider" do
context "with empty relationships" do
it "#allowed_instance_types" do
Expand Down