From 3f3ee5b899a5ae28d4d1d62857321f126b564a2e Mon Sep 17 00:00:00 2001 From: d-m-u Date: Wed, 17 Jan 2018 10:09:39 -0500 Subject: [PATCH] Add tests to check that cloud network list is dependent on zone --- .../cloud_manager/provision_workflow_spec.rb | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/spec/models/manageiq/providers/azure/cloud_manager/provision_workflow_spec.rb b/spec/models/manageiq/providers/azure/cloud_manager/provision_workflow_spec.rb index 03551a0d..90e0fb86 100644 --- a/spec/models/manageiq/providers/azure/cloud_manager/provision_workflow_spec.rb +++ b/spec/models/manageiq/providers/azure/cloud_manager/provision_workflow_spec.rb @@ -160,9 +160,10 @@ context "with VPC relationships" do before do + @az1 = FactoryGirl.create(:availability_zone, :ext_management_system => ems) @cn1 = FactoryGirl.create(:cloud_network, :ext_management_system => ems.network_manager) - @cs1 = FactoryGirl.create(:cloud_subnet, :cloud_network => @cn1) - @cs2 = FactoryGirl.create(:cloud_subnet, :cloud_network => @cn1) + FactoryGirl.create(:cloud_subnet, :cloud_network => @cn1, :availability_zone => @az1) + FactoryGirl.create(:cloud_subnet, :cloud_network => @cn1) end context "#allowed_cloud_subnets" do @@ -175,6 +176,19 @@ expect(workflow.allowed_cloud_subnets.length).to eq(2) end end + + context "#allowed_cloud_networks" do + it "#allowed_cloud_networks with zone" do + workflow.values[:placement_availability_zone] = [@az1.id, @az1.name] + cns = workflow.allowed_cloud_networks + expect(cns.keys).to match_array [@cn1.id] + end + + it "#allowed_cloud_networks without availability zone returns nothing" do + cns = workflow.allowed_cloud_networks + expect(cns.keys).to match_array [] + end + end end context "#display_name_for_name_description" do