diff options
author | Justin Clark-Casey (justincc) | 2011-06-04 02:39:26 +0100 |
---|---|---|
committer | Justin Clark-Casey (justincc) | 2011-06-04 02:39:26 +0100 |
commit | 12b1cbf8bfc559e4da40abf518e8e99fac793870 (patch) | |
tree | ba588348ce68360372cf73a07fd3eb5057234b75 /OpenSim/Tests/Common | |
parent | insert an InventoryArchiveUtils.FindItemsByPath() to return multiple items ra... (diff) | |
download | opensim-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')
-rw-r--r-- | OpenSim/Tests/Common/Helpers/UserAccountHelpers.cs | 11 | ||||
-rw-r--r-- | OpenSim/Tests/Common/Helpers/UserInventoryHelpers.cs | 25 |
2 files changed, 27 insertions, 9 deletions
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 | |||
118 | 118 | ||
119 | public static UserAccount CreateUserWithInventory(Scene scene) | 119 | public static UserAccount CreateUserWithInventory(Scene scene) |
120 | { | 120 | { |
121 | return CreateUserWithInventory(scene, 99); | ||
122 | } | ||
123 | |||
124 | public static UserAccount CreateUserWithInventory(Scene scene, int uuidTail) | ||
125 | { | ||
121 | return CreateUserWithInventory( | 126 | return CreateUserWithInventory( |
122 | scene, "Bill", "Bailey", UUID.Parse("00000000-0000-0000-0000-000000000099"), "troll"); | 127 | scene, "Bill", "Bailey", new UUID(string.Format("00000000-0000-0000-0000-{0:X12}", uuidTail)), "troll"); |
123 | } | 128 | } |
124 | 129 | ||
125 | public static UserAccount CreateUserWithInventory( | 130 | public static UserAccount CreateUserWithInventory( |
126 | Scene scene, string firstName, string lastName, UUID userId, string pw) | 131 | Scene scene, string firstName, string lastName, UUID userId, string pw) |
127 | { | 132 | { |
128 | UserAccount ua | 133 | UserAccount ua = new UserAccount(userId) { FirstName = firstName, LastName = lastName }; |
129 | = new UserAccount(userId) | ||
130 | { FirstName = firstName, LastName = lastName }; | ||
131 | CreateUserWithInventory(scene, ua, pw); | 134 | CreateUserWithInventory(scene, ua, pw); |
132 | return ua; | 135 | return ua; |
133 | } | 136 | } |
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 |