@mock.patch.object(helpers.OpenStackHelper, "get_volumes")
    def test_index(self, m_volumes):
        for tenant in fakes.tenants.values():
            vols = fakes.volumes[tenant["id"]]
            m_volumes.return_value = vols
            ret = self.controller.index(None)
            self.assertIsInstance(ret, collection.Collection)
            # NOTE(aloga): the only tenant with an attachment
            if tenant["name"] == "baz":
                for idx, vol in enumerate(vols):
                    self.assertIsInstance(ret.resources[idx],
                                          storage_link.StorageLink)
                    server_id = vol["attachments"][0]["server_id"]
                    link_id = "%s_%s" % (server_id, vol["id"])
                    self.assertEqual(link_id, ret.resources[idx].id)
            else:
                self.assertEqual([], ret.resources)
            m_volumes.assert_called_with(None)
dataset/ETHPy150Open openstack/ooi/ooi/tests/controllers/test_storage_links.py/TestStorageLinkController.test_index/original