From 6d5c25cf79a2980ab0c7a1d1444dd1db24ca6e28 Mon Sep 17 00:00:00 2001 From: Douglas Gabriel Date: Tue, 9 Jan 2018 17:26:38 -0300 Subject: [PATCH] Adding factory to ExtManagementSystem with invalid credentials --- spec/factories/ext_management_system.rb | 108 +++++++++++++++++------- 1 file changed, 77 insertions(+), 31 deletions(-) diff --git a/spec/factories/ext_management_system.rb b/spec/factories/ext_management_system.rb index 6b0bdb119efd..741569681bb3 100644 --- a/spec/factories/ext_management_system.rb +++ b/spec/factories/ext_management_system.rb @@ -28,6 +28,12 @@ create_list :storage, evaluator.storage_count, :ext_management_system => ems end end + + trait :with_invalid_authentication do + after(:create) do |x| + x.authentications << FactoryGirl.build(:authentication, :resource => x, :status => "invalid") + end + end end # Intermediate classes @@ -35,86 +41,111 @@ factory :ems_infra, :aliases => ["manageiq/providers/infra_manager"], :class => "ManageIQ::Providers::InfraManager", - :parent => :ext_management_system + :parent => :ext_management_system do + end factory :ems_physical_infra, :aliases => ["manageiq/providers/physical_infra_manager"], :class => "ManageIQ::Providers::PhysicalInfraManager", - :parent => :ext_management_system + :parent => :ext_management_system do + end + + factory :ems_physical_infra_with_invalid_authentication, + :aliases => ["manageiq/providers/physical_infra_manager_with_invalid_authentication"], + :class => "ManageIQ::Providers::PhysicalInfraManager", + :parent => :ext_management_system do + after(:create) do |x| + x.authentications = [FactoryGirl.build(:authentication, :resource => x, :status => "valid")] + end + end factory :ems_cloud, :aliases => ["manageiq/providers/cloud_manager"], :class => "ManageIQ::Providers::CloudManager", - :parent => :ext_management_system + :parent => :ext_management_system do + end factory :ems_datawarehouse, :aliases => ["manageiq/providers/datawarehouse_manager"], :class => "ManageIQ::Providers::DatawarehouseManager", - :parent => :ext_management_system + :parent => :ext_management_system do + end factory :ems_network, :aliases => ["manageiq/providers/network_manager"], :class => "ManageIQ::Providers::NetworkManager", - :parent => :ext_management_system + :parent => :ext_management_system do + end factory :ems_storage, :aliases => ["manageiq/providers/storage_manager"], :class => "ManageIQ::Providers::StorageManager", - :parent => :ext_management_system + :parent => :ext_management_system do + end factory :ems_cinder, :aliases => ["manageiq/providers/storage_manager/cinder_manager"], :class => "ManageIQ::Providers::StorageManager::CinderManager", - :parent => :ext_management_system + :parent => :ext_management_system do + end factory :ems_swift, :aliases => ["manageiq/providers/storage_manager/swift_manager"], :class => "ManageIQ::Providers::StorageManager::SwiftManager", - :parent => :ext_management_system + :parent => :ext_management_system do + end factory :ems_container, :aliases => ["manageiq/providers/container_manager"], :class => "ManageIQ::Providers::ContainerManager", - :parent => :ext_management_system + :parent => :ext_management_system do + end factory :ems_middleware, :aliases => ["manageiq/providers/middleware_manager"], :class => "ManageIQ::Providers::MiddlewareManager", - :parent => :ext_management_system + :parent => :ext_management_system do + end factory :configuration_manager, :aliases => ["manageiq/providers/configuration_manager"], :class => "ManageIQ::Providers::ConfigurationManager", - :parent => :ext_management_system + :parent => :ext_management_system do + end # Automation managers factory :automation_manager, :aliases => ["manageiq/providers/automation_manager"], :class => "ManageIQ::Providers::AutomationManager", - :parent => :ext_management_system + :parent => :ext_management_system do + end factory :external_automation_manager, :aliases => ["manageiq/providers/external_automation_manager"], :class => "ManageIQ::Providers::ExternalAutomationManager", - :parent => :automation_manager + :parent => :automation_manager do + end factory :embedded_automation_manager, :aliases => ["manageiq/providers/embedded_automation_manager"], :class => "ManageIQ::Providers::EmbeddedAutomationManager", - :parent => :automation_manager + :parent => :automation_manager do + end factory :provisioning_manager, :aliases => ["manageiq/providers/provisioning_manager"], :class => "ManageIQ::Providers::ProvisioningManager", - :parent => :ext_management_system + :parent => :ext_management_system do + end # Leaf classes for ems_infra factory :ems_vmware, :aliases => ["manageiq/providers/vmware/infra_manager"], :class => "ManageIQ::Providers::Vmware::InfraManager", - :parent => :ems_infra + :parent => :ems_infra do + end factory :ems_vmware_with_authentication, :parent => :ems_vmware do @@ -126,7 +157,8 @@ factory :ems_microsoft, :aliases => ["manageiq/providers/microsoft/infra_manager"], :class => "ManageIQ::Providers::Microsoft::InfraManager", - :parent => :ems_infra + :parent => :ems_infra do + end factory :ems_microsoft_with_authentication, :parent => :ems_microsoft do @@ -138,7 +170,8 @@ factory :ems_redhat, :aliases => ["manageiq/providers/redhat/infra_manager"], :class => "ManageIQ::Providers::Redhat::InfraManager", - :parent => :ems_infra + :parent => :ems_infra do + end factory :ems_redhat_v3, :parent => :ems_redhat do @@ -167,7 +200,8 @@ factory :ems_openstack_infra, :aliases => ["manageiq/providers/openstack/infra_manager"], :class => "ManageIQ::Providers::Openstack::InfraManager", - :parent => :ems_infra + :parent => :ems_infra do + end factory :ems_openstack_infra_with_stack, :parent => :ems_openstack_infra do @@ -197,12 +231,14 @@ factory :ems_vmware_cloud, :aliases => ["manageiq/providers/vmware/cloud_manager"], :class => "ManageIQ::Providers::Vmware::CloudManager", - :parent => :ems_cloud + :parent => :ems_cloud do + end factory :ems_vmware_cloud_network, :aliases => ["manageiq/providers/vmware/network_manager"], :class => "ManageIQ::Providers::Vmware::NetworkManager", - :parent => :ems_cloud + :parent => :ems_cloud do + end # Leaf classes for ems_cloud @@ -237,12 +273,14 @@ factory :ems_azure, :aliases => ["manageiq/providers/azure/cloud_manager"], :class => "ManageIQ::Providers::Azure::CloudManager", - :parent => :ems_cloud + :parent => :ems_cloud do + end factory :ems_azure_network, :aliases => ["manageiq/providers/azure/network_manager"], :class => "ManageIQ::Providers::Azure::NetworkManager", - :parent => :ems_network + :parent => :ems_network do + end factory :ems_azure_with_authentication, :parent => :ems_azure do @@ -256,7 +294,8 @@ factory :ems_openstack, :aliases => ["manageiq/providers/openstack/cloud_manager"], :class => "ManageIQ::Providers::Openstack::CloudManager", - :parent => :ems_cloud + :parent => :ems_cloud do + end factory :ems_openstack_with_authentication, :parent => :ems_openstack do @@ -269,12 +308,14 @@ factory :ems_openstack_network, :aliases => ["manageiq/providers/openstack/network_manager"], :class => "ManageIQ::Providers::Openstack::NetworkManager", - :parent => :ems_network + :parent => :ems_network do + end factory :ems_nuage_network, :aliases => ["manageiq/providers/nuage/network_manager"], :class => "ManageIQ::Providers::Nuage::NetworkManager", - :parent => :ems_network + :parent => :ems_network do + end factory :ems_google, :aliases => ["manageiq/providers/google/cloud_manager"], @@ -302,7 +343,8 @@ factory :ems_kubernetes, :aliases => ["manageiq/providers/kubernetes/container_manager"], :class => "ManageIQ::Providers::Kubernetes::ContainerManager", - :parent => :ems_container + :parent => :ems_container do + end factory :ems_kubernetes_with_authentication_err, :parent => :ems_kubernetes do @@ -315,7 +357,8 @@ factory :ems_openshift, :aliases => ["manageiq/providers/openshift/container_manager"], :class => "ManageIQ::Providers::Openshift::ContainerManager", - :parent => :ems_container + :parent => :ems_container do + end # Leaf classes for configuration_manager @@ -352,19 +395,22 @@ factory :provisioning_manager_foreman, :aliases => ["manageiq/providers/foreman/provisioning_manager"], :class => "ManageIQ::Providers::Foreman::ProvisioningManager", - :parent => :provisioning_manager + :parent => :provisioning_manager do + end # Leaf classes for middleware_manager factory :ems_hawkular, :aliases => ["manageiq/providers/hawkular/middleware_manager"], :class => "ManageIQ::Providers::Hawkular::MiddlewareManager", - :parent => :ems_middleware + :parent => :ems_middleware do + end # Leaf classes for datawarehouse_manager factory :ems_hawkular_datawarehouse, :aliases => ["manageiq/providers/hawkular/datawarehouse_manager"], :class => "ManageIQ::Providers::Hawkular::DatawarehouseManager", - :parent => :ems_datawarehouse + :parent => :ems_datawarehouse do + end end