Shuffle some code around

httptests
Diva Canto 2017-05-01 16:49:42 -07:00
parent 3c43cdbbcc
commit 9c82ff7673
3 changed files with 22 additions and 15 deletions

View File

@ -286,6 +286,26 @@ namespace OpenSim.Tests.Permissions
return clone; return clone;
} }
public void DeleteObjectsFolders()
{
// Delete everything in A2 and A3's Objects folders, so we can restart
for (int i = 1; i < 3; i++)
{
InventoryFolderBase objsFolder = UserInventoryHelpers.GetInventoryFolder(Common.TheScene.InventoryService, Common.TheAvatars[i].UUID, "Objects");
Assert.That(objsFolder, Is.Not.Null);
List<InventoryItemBase> items = Common.TheScene.InventoryService.GetFolderItems(Common.TheAvatars[i].UUID, objsFolder.ID);
List<UUID> ids = new List<UUID>();
foreach (InventoryItemBase it in items)
ids.Add(it.ID);
Common.TheScene.InventoryService.DeleteItems(Common.TheAvatars[i].UUID, ids);
items = Common.TheScene.InventoryService.GetFolderItems(Common.TheAvatars[i].UUID, objsFolder.ID);
Assert.That(items.Count, Is.EqualTo(0), "A" + (i + 1));
}
}
public string IdStr(InventoryItemBase item) public string IdStr(InventoryItemBase item)
{ {
return item.Owner.ToString().Substring(34) + " : " + item.Name; return item.Owner.ToString().Substring(34) + " : " + item.Name;

View File

@ -44,6 +44,7 @@ namespace OpenSim.Tests.Permissions
[SetUp] [SetUp]
public void SetUp() public void SetUp()
{ {
Common.TheInstance.DeleteObjectsFolders();
} }
/// <summary> /// <summary>

View File

@ -46,21 +46,7 @@ namespace OpenSim.Tests.Permissions
[SetUp] [SetUp]
public void SetUp() public void SetUp()
{ {
// Delete everything in A2 and A3's Objects folders from previous tests Common.TheInstance.DeleteObjectsFolders();
for (int i = 1; i < 3; i++)
{
InventoryFolderBase objsFolder = UserInventoryHelpers.GetInventoryFolder(Common.TheScene.InventoryService, Common.TheAvatars[i].UUID, "Objects");
Assert.That(objsFolder, Is.Not.Null);
List<InventoryItemBase> items = Common.TheScene.InventoryService.GetFolderItems(Common.TheAvatars[i].UUID, objsFolder.ID);
List<UUID> ids = new List<UUID>();
foreach (InventoryItemBase it in items)
ids.Add(it.ID);
Common.TheScene.InventoryService.DeleteItems(Common.TheAvatars[i].UUID, ids);
items = Common.TheScene.InventoryService.GetFolderItems(Common.TheAvatars[i].UUID, objsFolder.ID);
Assert.That(items.Count, Is.EqualTo(0), "A" + (i+1));
}
} }
/// <summary> /// <summary>