aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Tests/Common/Helpers/UserInventoryHelpers.cs
diff options
context:
space:
mode:
authorJustin Clark-Casey (justincc)2011-06-04 02:39:26 +0100
committerJustin Clark-Casey (justincc)2011-06-04 02:39:26 +0100
commit12b1cbf8bfc559e4da40abf518e8e99fac793870 (patch)
treeba588348ce68360372cf73a07fd3eb5057234b75 /OpenSim/Tests/Common/Helpers/UserInventoryHelpers.cs
parentinsert an InventoryArchiveUtils.FindItemsByPath() to return multiple items ra... (diff)
downloadopensim-SC_OLD-12b1cbf8bfc559e4da40abf518e8e99fac793870.zip
opensim-SC_OLD-12b1cbf8bfc559e4da40abf518e8e99fac793870.tar.gz
opensim-SC_OLD-12b1cbf8bfc559e4da40abf518e8e99fac793870.tar.bz2
opensim-SC_OLD-12b1cbf8bfc559e4da40abf518e8e99fac793870.tar.xz
Fix give inventory tests to use different users rather than (accidentally) the same user. Extend TestGiveInventoryItem() to test giving back the same item.
Diffstat (limited to 'OpenSim/Tests/Common/Helpers/UserInventoryHelpers.cs')
-rw-r--r--OpenSim/Tests/Common/Helpers/UserInventoryHelpers.cs25
1 files changed, 20 insertions, 5 deletions
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
65 /// <returns></returns> 65 /// <returns></returns>
66 public static InventoryItemBase CreateInventoryItem(Scene scene, string itemName, UUID itemId, UUID userId) 66 public static InventoryItemBase CreateInventoryItem(Scene scene, string itemName, UUID itemId, UUID userId)
67 { 67 {
68 AssetBase asset = AssetHelpers.CreateAsset(scene, userId);
68 InventoryItemBase item = new InventoryItemBase(); 69 InventoryItemBase item = new InventoryItemBase();
69 item.Name = itemName; 70 item.Name = itemName;
70 item.AssetID = AssetHelpers.CreateAsset(scene, userId).FullID; 71 item.AssetID = asset.FullID;
71 item.ID = itemId; 72 item.ID = itemId;
73 item.Owner = userId;
74 item.AssetType = asset.Type;
75 item.InvType = (int)InventoryType.Notecard;
76
77 InventoryFolderBase folder = scene.InventoryService.GetFolderForType(userId, AssetType.Notecard);
72 78
73 // Really quite bad since the objs folder could be moved in the future and confuse the tests 79 item.Folder = folder.ID;
74 InventoryFolderBase objsFolder = scene.InventoryService.GetFolderForType(userId, AssetType.Object);
75
76 item.Folder = objsFolder.ID;
77 scene.AddInventoryItem(item); 80 scene.AddInventoryItem(item);
78 81
79 return item; 82 return item;
@@ -165,5 +168,17 @@ namespace OpenSim.Tests.Common
165 { 168 {
166 return InventoryArchiveUtils.FindItemByPath(inventoryService, userId, path); 169 return InventoryArchiveUtils.FindItemByPath(inventoryService, userId, path);
167 } 170 }
171
172 /// <summary>
173 /// Get the inventory items that match the path name.
174 /// </summary>
175 /// <param name="inventoryService"></param>
176 /// <param name="userId"></param>
177 /// <param name="path"></param>
178 /// <returns>An empty list if no matching items were found.</returns>
179 public static List<InventoryItemBase> GetInventoryItems(IInventoryService inventoryService, UUID userId, string path)
180 {
181 return InventoryArchiveUtils.FindItemsByPath(inventoryService, userId, path);
182 }
168 } 183 }
169} \ No newline at end of file 184} \ No newline at end of file