def test_should_get_compatible_systems(self): self.storage_volume_templates.get_by.return_value = [{ 'name': 'SVT1', 'uri': '/rest/fake' }] self.storage_volume_templates.get_compatible_systems.return_value = { "name": "Storage System Name" } self.mock_ansible_module.params = PARAMS_GET_COMPATIBLE StorageVolumeTemplateFactsModule().run() self.mock_ansible_module.exit_json.assert_called_once_with( changed=False, ansible_facts={ 'compatible_systems': { 'name': 'Storage System Name' }, 'storage_volume_templates': [{ 'name': 'SVT1', 'uri': '/rest/fake' }] })
def test_should_get_storage_volume_template_by_name(self): self.storage_volume_templates.get_by.return_value = DEFAULT_VOLUME_TEMPLATES_RETURN self.mock_ansible_module.params = PARAMS_GET_BY_NAME StorageVolumeTemplateFactsModule().run() self.mock_ansible_module.exit_json.assert_called_once_with( changed=False, ansible_facts=dict( storage_volume_templates=(DEFAULT_VOLUME_TEMPLATES_RETURN)))
def test_should_get_reachable_storage_volume_templates(self): self.resource.get_all.return_value = DEFAULT_VOLUME_TEMPLATES_RETURN self.resource.get_reachable_volume_templates.return_value = DEFAULT_VOLUME_TEMPLATES_RETURN self.mock_ansible_module.params = PARAMS_GET_REACHABLE StorageVolumeTemplateFactsModule().run() self.mock_ansible_module.exit_json.assert_called_once_with( changed=False, ansible_facts={'reachable_volume_templates': DEFAULT_VOLUME_TEMPLATES_RETURN, 'storage_volume_templates': DEFAULT_VOLUME_TEMPLATES_RETURN} )
def test_should_get_storage_volume_template_by_name(self): self.storage_volume_templates.get_by.return_value = { "name": "Storage System Name" } self.mock_ansible_module.params = PARAMS_GET_BY_NAME StorageVolumeTemplateFactsModule().run() self.mock_ansible_module.exit_json.assert_called_once_with( changed=False, ansible_facts=dict( storage_volume_templates=({ "name": "Storage System Name" })))
def test_should_get_connectable_storage_volume_templates(self): self.storage_volume_templates.get_all.return_value = { "name": "Storage System Name" } self.storage_volume_templates.get_connectable_volume_templates.return_value = { "name": "Storage System Name" } self.mock_ansible_module.params = PARAMS_GET_CONNECTED StorageVolumeTemplateFactsModule().run() self.mock_ansible_module.exit_json.assert_called_once_with( changed=False, ansible_facts={ 'connectable_volume_templates': { 'name': 'Storage System Name' }, 'storage_volume_templates': { 'name': 'Storage System Name' } })