extend TestGiveInventoryFolder() to check for the receipt by user 2

bulletsim
Justin Clark-Casey (justincc) 2011-06-04 00:20:54 +01:00
parent 66004a9375
commit 1543fd7fff
2 changed files with 25 additions and 2 deletions

View File

@ -66,8 +66,10 @@ namespace OpenSim.Region.Framework.Tests
scene.GiveInventoryFolder(user2.PrincipalID, user1.PrincipalID, folder1.ID, UUID.Zero); scene.GiveInventoryFolder(user2.PrincipalID, user1.PrincipalID, folder1.ID, UUID.Zero);
// InventoryFolderBase receivedFolder1Template = new InventoryFolderBase( InventoryFolderBase retrievedFolder1
// InventoryFolderBase receivedFolder1 = scene.InventoryService.GetFolder = UserInventoryHelpers.GetInventoryFolder(scene.InventoryService, user2.PrincipalID, "folder1");
Assert.That(retrievedFolder1, Is.Not.Null);
} }
} }
} }

View File

@ -26,8 +26,10 @@
*/ */
using System; using System;
using System.Collections.Generic;
using OpenMetaverse; using OpenMetaverse;
using OpenSim.Framework; using OpenSim.Framework;
using OpenSim.Region.CoreModules.Avatar.Inventory.Archiver;
using OpenSim.Region.Framework.Scenes; using OpenSim.Region.Framework.Scenes;
using OpenSim.Services.Interfaces; using OpenSim.Services.Interfaces;
@ -118,5 +120,24 @@ namespace OpenSim.Tests.Common
else else
return newFolder; return newFolder;
} }
/// <summary>
/// Get the inventory folder that matches the path name. If there are multiple folders then only the first
/// is returned.
/// </summary>
/// <param name="inventoryService"></param>
/// <param name="userId"></param>
/// <param name="path"></param>
/// <returns>null if no folder matching the path was found</returns>
public static InventoryFolderBase GetInventoryFolder(IInventoryService inventoryService, UUID userId, string path)
{
List<InventoryFolderBase> folders
= InventoryArchiveUtils.FindFolderByPath(inventoryService, userId, path);
if (folders.Count != 0)
return folders[0];
else
return null;
}
} }
} }