Example #1
0
    def test_should_get_storage_pool_by_name(self):
        self.resource.get_by.return_value = {"name": "Storage Pool Name"}
        self.mock_ansible_module.params = PARAMS_GET_BY_NAME

        StoragePoolFactsModule().run()

        self.mock_ansible_module.exit_json.assert_called_once_with(
            changed=False,
            ansible_facts=dict(storage_pools=({
                "name": "Storage Pool Name"
            })))
Example #2
0
    def test_should_get_all_storage_pool(self):
        self.resource.get_all.return_value = [{"name": "Storage Pool Name"}]
        self.mock_ansible_module.params = PARAMS_GET_ALL

        StoragePoolFactsModule().run()

        self.mock_ansible_module.exit_json.assert_called_once_with(
            changed=False,
            ansible_facts=dict(storage_pools=[{
                "name": "Storage Pool Name"
            }]))
Example #3
0
    def test_should_get_reachable_storage_pools(self):
        self.mock_ov_client.api_version = 500
        self.resource.get_by.return_value = {"name": "Storage Pool Name"}
        self.resource.get_reachable_storage_pools.return_value = [{
            'reachable':
            'test'
        }]
        self.mock_ansible_module.params = PARAMS_GET_REACHABLE_STORAGE_POOLS

        StoragePoolFactsModule().run()

        self.mock_ansible_module.exit_json.assert_called_once_with(
            changed=False,
            ansible_facts=dict(storage_pools_reachable_storage_pools=[{
                'reachable':
                'test'
            }],
                               storage_pools={"name": "Storage Pool Name"}))