From 12b1cbf8bfc559e4da40abf518e8e99fac793870 Mon Sep 17 00:00:00 2001
From: Justin Clark-Casey (justincc)
Date: Sat, 4 Jun 2011 02:39:26 +0100
Subject: Fix give inventory tests to use different users rather than
(accidentally) the same user. Extend TestGiveInventoryItem() to test giving
back the same item.
---
OpenSim/Tests/Common/Helpers/UserAccountHelpers.cs | 11 ++++++----
.../Tests/Common/Helpers/UserInventoryHelpers.cs | 25 +++++++++++++++++-----
2 files changed, 27 insertions(+), 9 deletions(-)
(limited to 'OpenSim/Tests')
diff --git a/OpenSim/Tests/Common/Helpers/UserAccountHelpers.cs b/OpenSim/Tests/Common/Helpers/UserAccountHelpers.cs
index 8cfad79..d924ecd 100644
--- a/OpenSim/Tests/Common/Helpers/UserAccountHelpers.cs
+++ b/OpenSim/Tests/Common/Helpers/UserAccountHelpers.cs
@@ -118,16 +118,19 @@ namespace OpenSim.Tests.Common
public static UserAccount CreateUserWithInventory(Scene scene)
{
+ return CreateUserWithInventory(scene, 99);
+ }
+
+ public static UserAccount CreateUserWithInventory(Scene scene, int uuidTail)
+ {
return CreateUserWithInventory(
- scene, "Bill", "Bailey", UUID.Parse("00000000-0000-0000-0000-000000000099"), "troll");
+ scene, "Bill", "Bailey", new UUID(string.Format("00000000-0000-0000-0000-{0:X12}", uuidTail)), "troll");
}
public static UserAccount CreateUserWithInventory(
Scene scene, string firstName, string lastName, UUID userId, string pw)
{
- UserAccount ua
- = new UserAccount(userId)
- { FirstName = firstName, LastName = lastName };
+ UserAccount ua = new UserAccount(userId) { FirstName = firstName, LastName = lastName };
CreateUserWithInventory(scene, ua, pw);
return ua;
}
diff --git a/OpenSim/Tests/Common/Helpers/UserInventoryHelpers.cs b/OpenSim/Tests/Common/Helpers/UserInventoryHelpers.cs
index 93b655a..875bf4a 100644
--- a/OpenSim/Tests/Common/Helpers/UserInventoryHelpers.cs
+++ b/OpenSim/Tests/Common/Helpers/UserInventoryHelpers.cs
@@ -65,15 +65,18 @@ namespace OpenSim.Tests.Common
///
public static InventoryItemBase CreateInventoryItem(Scene scene, string itemName, UUID itemId, UUID userId)
{
+ AssetBase asset = AssetHelpers.CreateAsset(scene, userId);
InventoryItemBase item = new InventoryItemBase();
item.Name = itemName;
- item.AssetID = AssetHelpers.CreateAsset(scene, userId).FullID;
+ item.AssetID = asset.FullID;
item.ID = itemId;
+ item.Owner = userId;
+ item.AssetType = asset.Type;
+ item.InvType = (int)InventoryType.Notecard;
+
+ InventoryFolderBase folder = scene.InventoryService.GetFolderForType(userId, AssetType.Notecard);
- // Really quite bad since the objs folder could be moved in the future and confuse the tests
- InventoryFolderBase objsFolder = scene.InventoryService.GetFolderForType(userId, AssetType.Object);
-
- item.Folder = objsFolder.ID;
+ item.Folder = folder.ID;
scene.AddInventoryItem(item);
return item;
@@ -165,5 +168,17 @@ namespace OpenSim.Tests.Common
{
return InventoryArchiveUtils.FindItemByPath(inventoryService, userId, path);
}
+
+ ///
+ /// Get the inventory items that match the path name.
+ ///
+ ///
+ ///
+ ///
+ /// An empty list if no matching items were found.
+ public static List GetInventoryItems(IInventoryService inventoryService, UUID userId, string path)
+ {
+ return InventoryArchiveUtils.FindItemsByPath(inventoryService, userId, path);
+ }
}
}
\ No newline at end of file
--
cgit v1.1