From 7fe768a98d65508392095b02435cbd7d19785244 Mon Sep 17 00:00:00 2001 From: "Justin Clark-Casey (justincc)" Date: Mon, 11 Feb 2013 22:16:07 +0000 Subject: [PATCH] Add test to try reading notecard into an invalid path in TestJsonReadNotecard() regression test --- .../Tests/JsonStoreScriptModuleTests.cs | 20 ++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/OpenSim/Region/OptionalModules/Scripting/JsonStore/Tests/JsonStoreScriptModuleTests.cs b/OpenSim/Region/OptionalModules/Scripting/JsonStore/Tests/JsonStoreScriptModuleTests.cs index af97ac7c0b..e91c02daff 100644 --- a/OpenSim/Region/OptionalModules/Scripting/JsonStore/Tests/JsonStoreScriptModuleTests.cs +++ b/OpenSim/Region/OptionalModules/Scripting/JsonStore/Tests/JsonStoreScriptModuleTests.cs @@ -357,8 +357,7 @@ namespace OpenSim.Region.OptionalModules.Scripting.JsonStore.Tests UUID receivingStoreId = (UUID)InvokeOp("JsonCreateStore", "{}"); UUID readNotecardRequestId = (UUID)InvokeOpOnHost("JsonReadNotecard", so.UUID, receivingStoreId, "make", notecardName); Assert.That(readNotecardRequestId, Is.Not.EqualTo(UUID.Zero)); - - // These don't behave as I expect yet - reading to a path still seems to place the notecard contents at the root. + string value = (string)InvokeOp("JsonGetValue", receivingStoreId, "Hello"); Assert.That(value, Is.EqualTo("")); @@ -367,27 +366,24 @@ namespace OpenSim.Region.OptionalModules.Scripting.JsonStore.Tests } { - // Read notecard to new multi-component path + // Read notecard to new multi-component path. This should not work. UUID receivingStoreId = (UUID)InvokeOp("JsonCreateStore", "{}"); UUID readNotecardRequestId = (UUID)InvokeOpOnHost("JsonReadNotecard", so.UUID, receivingStoreId, "make.it", notecardName); Assert.That(readNotecardRequestId, Is.Not.EqualTo(UUID.Zero)); - // These don't behave as I expect yet - reading to a path still seems to place the notecard contents at the root. string value = (string)InvokeOp("JsonGetValue", receivingStoreId, "Hello"); Assert.That(value, Is.EqualTo("")); - // TODO: Check that we are not expecting reading to a new path to work. value = (string)InvokeOp("JsonGetValue", receivingStoreId, "make.it.Hello"); Assert.That(value, Is.EqualTo("")); } { - // Read notecard to existing multi-component path + // Read notecard to existing multi-component path. This should work UUID receivingStoreId = (UUID)InvokeOp("JsonCreateStore", "{ 'make' : { 'it' : 'so' } }"); UUID readNotecardRequestId = (UUID)InvokeOpOnHost("JsonReadNotecard", so.UUID, receivingStoreId, "make.it", notecardName); Assert.That(readNotecardRequestId, Is.Not.EqualTo(UUID.Zero)); - // These don't behave as I expect yet - reading to a path still seems to place the notecard contents at the root. string value = (string)InvokeOp("JsonGetValue", receivingStoreId, "Hello"); Assert.That(value, Is.EqualTo("")); @@ -395,6 +391,16 @@ namespace OpenSim.Region.OptionalModules.Scripting.JsonStore.Tests Assert.That(value, Is.EqualTo("World")); } + { + // Read notecard to invalid path. This should not work. + UUID receivingStoreId = (UUID)InvokeOp("JsonCreateStore", "{ 'make' : { 'it' : 'so' } }"); + UUID readNotecardRequestId = (UUID)InvokeOpOnHost("JsonReadNotecard", so.UUID, receivingStoreId, "/", notecardName); + Assert.That(readNotecardRequestId, Is.Not.EqualTo(UUID.Zero)); + + string value = (string)InvokeOp("JsonGetValue", receivingStoreId, "Hello"); + Assert.That(value, Is.EqualTo("")); + } + { // Try read notecard to fake store. UUID fakeStoreId = TestHelpers.ParseTail(0x500);