Skip to content

Commit

Permalink
Adding factory to ExtManagementSystem with invalid credentials
Browse files Browse the repository at this point in the history
  • Loading branch information
douglasgabriel committed Jan 10, 2018
1 parent 79d25e3 commit 6d5c25c
Showing 1 changed file with 77 additions and 31 deletions.
108 changes: 77 additions & 31 deletions spec/factories/ext_management_system.rb
Original file line number Diff line number Diff line change
Expand Up @@ -28,93 +28,124 @@
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

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
Expand All @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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

Expand Down Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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"],
Expand Down Expand Up @@ -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
Expand All @@ -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

Expand Down Expand Up @@ -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

0 comments on commit 6d5c25c

Please sign in to comment.