From f8ce49875597bafb39642b62e2a61b644ecf489a Mon Sep 17 00:00:00 2001 From: Justin Clarke Casey Date: Fri, 12 Dec 2008 19:04:10 +0000 Subject: [PATCH] * extend user profile create folder test to check that one can't create a folder with a non-existant parent folder id --- .../Tests/Cache/UserProfileCacheServiceTests.cs | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/OpenSim/Framework/Communications/Tests/Cache/UserProfileCacheServiceTests.cs b/OpenSim/Framework/Communications/Tests/Cache/UserProfileCacheServiceTests.cs index 6632643489..a229e2afdf 100644 --- a/OpenSim/Framework/Communications/Tests/Cache/UserProfileCacheServiceTests.cs +++ b/OpenSim/Framework/Communications/Tests/Cache/UserProfileCacheServiceTests.cs @@ -74,7 +74,7 @@ namespace OpenSim.Framework.Communications.Tests } /// - /// Test moving an inventory folder + /// Test creating an inventory folder /// [Test] public void TestCreateFolder() @@ -89,7 +89,18 @@ namespace OpenSim.Framework.Communications.Tests UUID folderId = UUID.Parse("00000000-0000-0000-0000-000000000010"); Assert.That(userInfo.RootFolder.ContainsChildFolder(folderId), Is.False); - userInfo.CreateFolder("testFolder", folderId, (ushort)AssetType.Animation, userInfo.RootFolder.ID); + // 1: Try a folder create that should fail because the parent id given does not exist + UUID missingFolderId = UUID.Random(); + + Assert.That( + userInfo.CreateFolder("testFolder1", folderId, (ushort)AssetType.Animation, missingFolderId), Is.False); + Assert.That(inventoryDataPlugin.getInventoryFolder(folderId), Is.Null); + Assert.That(userInfo.RootFolder.ContainsChildFolder(missingFolderId), Is.False); + Assert.That(userInfo.RootFolder.FindFolder(folderId), Is.Null); + + // 2: Try a folder create that should work + Assert.That( + userInfo.CreateFolder("testFolder2", folderId, (ushort)AssetType.Animation, userInfo.RootFolder.ID), Is.True); Assert.That(inventoryDataPlugin.getInventoryFolder(folderId), Is.Not.Null); Assert.That(userInfo.RootFolder.ContainsChildFolder(folderId), Is.True); }