'finding secrets with various usage_type.'

@mock.patch.object(fakelibvirt.virConnect, 'secretLookupByUsage')
def test_find_secret(self, mock_sec):

    expected = [mock.call(fakelibvirt.VIR_SECRET_USAGE_TYPE_CEPH, 'rbdvol'), mock.call(fakelibvirt.VIR_SECRET_USAGE_TYPE_CEPH, 'cephvol'), mock.call(fakelibvirt.VIR_SECRET_USAGE_TYPE_ISCSI, 'iscsivol'), mock.call(fakelibvirt.VIR_SECRET_USAGE_TYPE_VOLUME, 'vol')]
    self.host.find_secret('rbd', 'rbdvol')
    self.host.find_secret('ceph', 'cephvol')
    self.host.find_secret('iscsi', 'iscsivol')
    self.host.find_secret('volume', 'vol')
    self.assertEqual(expected, mock_sec.mock_calls)
    self.assertRaises(exception.NovaException, self.host.find_secret, 'foo', 'foovol')
    mock_sec.side_effect = fakelibvirt.libvirtError('')
    mock_sec.side_effect.err = (66,)
    self.assertIsNone(self.host.find_secret('rbd', 'rbdvol'))
