diff --git a/spec/models/manageiq/providers/amazon/aws_refresher_spec_common.rb b/spec/models/manageiq/providers/amazon/aws_refresher_spec_common.rb index bb06ae49c..0faadf26c 100644 --- a/spec/models/manageiq/providers/amazon/aws_refresher_spec_common.rb +++ b/spec/models/manageiq/providers/amazon/aws_refresher_spec_common.rb @@ -1431,6 +1431,10 @@ def create_tag_mapping @tag_mapping = FactoryGirl.create(:tag_mapping_with_category, :label_name => "EmsRefreshSpecResourceGroupTag") @tag_mapping_category = @tag_mapping.tag.classification + + @image_tag_mapping = FactoryGirl.create(:tag_mapping_with_category, + :label_name => "Name", :labeled_resource_type => "Image") + @image_tag_mapping_category = @image_tag_mapping.tag.classification end # Tests can assert this if they called create_tag_mapping before refresh. @@ -1444,4 +1448,19 @@ def assert_mapped_tags_on_vm expect(vm.tags.first.category).to eq(@tag_mapping_category) expect(vm.tags.first.classification.description).to eq("EmsRefreshSpecResourceGroupTagValue") end + + # Tests can assert this if they called create_tag_mapping before refresh. + def assert_mapped_tags_on_template + p @image_tag_mapping_category.children.collect(&:description) + expect(@image_tag_mapping_category.children.collect(&:description)).to include( + "suse-11-server-64", + "ubuntu-12.04-server-32", + # and many more... + ) + + template = ManageIQ::Providers::Amazon::CloudManager::Template.find_by(:name => "suse-11-server-64") + expect(template.tags.count).to eq(1) + expect(template.tags.first.category).to eq(@image_tag_mapping_category) + expect(template.tags.first.classification.description).to eq("suse-11-server-64") + end end diff --git a/spec/models/manageiq/providers/amazon/cloud_manager/vcr_specs/refresher_inventory_object_spec.rb b/spec/models/manageiq/providers/amazon/cloud_manager/vcr_specs/refresher_inventory_object_spec.rb index 35c1bc5ce..f39b758b1 100644 --- a/spec/models/manageiq/providers/amazon/cloud_manager/vcr_specs/refresher_inventory_object_spec.rb +++ b/spec/models/manageiq/providers/amazon/cloud_manager/vcr_specs/refresher_inventory_object_spec.rb @@ -33,6 +33,7 @@ end assert_common + assert_mapped_tags_on_template assert_mapped_tags_on_vm end end diff --git a/spec/models/manageiq/providers/amazon/cloud_manager/vcr_specs/refresher_spec.rb b/spec/models/manageiq/providers/amazon/cloud_manager/vcr_specs/refresher_spec.rb index 29ecf1fbf..a26ef3e49 100644 --- a/spec/models/manageiq/providers/amazon/cloud_manager/vcr_specs/refresher_spec.rb +++ b/spec/models/manageiq/providers/amazon/cloud_manager/vcr_specs/refresher_spec.rb @@ -34,6 +34,7 @@ end assert_common + assert_mapped_tags_on_template assert_mapped_tags_on_vm end end