def test_should_get_all_storage_system(self): self.resource.get_all.return_value = {"name": "Storage System Name"} self.mock_ansible_module.params = PARAMS_GET_ALL 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_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"}])) )
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_pools_system_by_name(self): self.resource.data = {"name": "Storage System Name", "uri": "uri"} self.resource.get_by_name.return_value = self.resource self.resource.get_storage_pools.return_value = {"name": "Storage Pool"} self.mock_ansible_module.params = PARAMS_GET_POOL_BY_NAME 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=[{"name": "Storage System Name", "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.data = {"name": "Storage System Name", "uri": "rest/123"} self.resource.get_by_hostname.return_value = self.resource 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"}] ) )