def test_should_get_storage_system_by_name(self):
        self.resource.get_by_name.return_value = {"name": "Storage System Name"}
        self.mock_ansible_module.params = PARAMS_GET_BY_NAME

        StorageSystemFactsModule().run()

        self.mock_ansible_module.exit_json.assert_called_once_with(
            changed=False,
            ansible_facts=dict(storage_systems=({"name": "Storage System Name"}))
        )
    def test_should_get_storage_system_by_hostname(self):
        self.mock_ov_client.api_version = 500
        self.resource.get_by_hostname.return_value = {"hostname": "10.0.0.0"}
        self.mock_ansible_module.params = PARAMS_GET_BY_HOSTNAME

        StorageSystemFactsModule().run()

        self.mock_ansible_module.exit_json.assert_called_once_with(
            changed=False,
            ansible_facts=dict(storage_systems=({"hostname": "10.0.0.0"}))
        )
Example #3
0
    def test_should_get_storage_system_by_ip_hostname(self):
        self.resource.data = {"ip_hostname": "10.0.0.0"}
        self.resource.get_by_ip_hostname.return_value = self.resource
        self.mock_ansible_module.params = PARAMS_GET_BY_HOSTNAME

        StorageSystemFactsModule().run()

        self.mock_ansible_module.exit_json.assert_called_once_with(
            changed=False,
            ansible_facts=dict(storage_systems=([{
                "ip_hostname": "10.0.0.0"
            }])))
Example #4
0
    def test_should_get_all_host_types(self):
        self.resource.get_host_types.return_value = HOST_TYPES
        self.resource.get_all.return_value = [{"name": "Storage System Name"}]
        self.mock_ansible_module.params = PARAMS_GET_HOST_TYPES

        StorageSystemFactsModule().run()

        self.mock_ansible_module.exit_json.assert_called_once_with(
            changed=False,
            ansible_facts=dict(storage_system_host_types=HOST_TYPES,
                               storage_systems=[{
                                   "name": "Storage System Name"
                               }]))
    def test_should_get_storage_system_pools_by_ip_hostname(self):
        self.resource.get_by_ip_hostname.return_value = {"ip_hostname": "10.0.0.0", "uri": "uri"}
        self.resource.get_storage_pools.return_value = {"name": "Storage Pool"}
        self.mock_ansible_module.params = PARAMS_GET_POOL_BY_IP_HOSTNAME

        StorageSystemFactsModule().run()

        self.mock_ansible_module.exit_json.assert_called_once_with(
            changed=False,
            ansible_facts=dict(
                storage_system_pools=({"name": "Storage Pool"}),
                storage_systems={"ip_hostname": "10.0.0.0", "uri": "uri"}
            )
        )
    def test_should_get_templates(self):
        self.mock_ov_client.api_version = 500
        self.resource.get_templates.return_value = [{'template': 'temp'}]
        self.resource.get_by_hostname.return_value = {"name": "Storage System Name", "uri": "rest/123"}
        self.mock_ansible_module.params = PARAMS_GET_TEMPLATES

        StorageSystemFactsModule().run()

        self.mock_ansible_module.exit_json.assert_called_once_with(
            changed=False,
            ansible_facts=dict(
                storage_system_templates=[{'template': 'temp'}],
                storage_systems={"name": "Storage System Name", "uri": "rest/123"})
        )
Example #7
0
    def test_should_get_reachable_ports(self):
        self.mock_ov_client.api_version = 500
        self.resource.get_reachable_ports.return_value = [{'port': 'port1'}]

        self.resource.data = {"name": "Storage System Name", "uri": "rest/123"}
        self.resource.get_by_hostname.return_value = self.resource

        self.mock_ansible_module.params = PARAMS_GET_REACHABLE_PORTS

        StorageSystemFactsModule().run()

        self.mock_ansible_module.exit_json.assert_called_once_with(
            changed=False,
            ansible_facts=dict(storage_system_reachable_ports=[{
                'port': 'port1'
            }],
                               storage_systems=[{
                                   "name": "Storage System Name",
                                   "uri": "rest/123"
                               }]))