Add test to try reading notecard into an invalid path in TestJsonReadNotecard() regression test

user_profiles
Justin Clark-Casey (justincc) 2013-02-11 22:16:07 +00:00
parent 6f3dcf58b8
commit c72c189864
1 changed files with 13 additions and 7 deletions

View File

@ -358,7 +358,6 @@ namespace OpenSim.Region.OptionalModules.Scripting.JsonStore.Tests
UUID readNotecardRequestId = (UUID)InvokeOpOnHost("JsonReadNotecard", so.UUID, receivingStoreId, "make", notecardName); UUID readNotecardRequestId = (UUID)InvokeOpOnHost("JsonReadNotecard", so.UUID, receivingStoreId, "make", notecardName);
Assert.That(readNotecardRequestId, Is.Not.EqualTo(UUID.Zero)); 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"); string value = (string)InvokeOp("JsonGetValue", receivingStoreId, "Hello");
Assert.That(value, Is.EqualTo("")); 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 receivingStoreId = (UUID)InvokeOp("JsonCreateStore", "{}");
UUID readNotecardRequestId = (UUID)InvokeOpOnHost("JsonReadNotecard", so.UUID, receivingStoreId, "make.it", notecardName); UUID readNotecardRequestId = (UUID)InvokeOpOnHost("JsonReadNotecard", so.UUID, receivingStoreId, "make.it", notecardName);
Assert.That(readNotecardRequestId, Is.Not.EqualTo(UUID.Zero)); 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"); string value = (string)InvokeOp("JsonGetValue", receivingStoreId, "Hello");
Assert.That(value, Is.EqualTo("")); 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"); value = (string)InvokeOp("JsonGetValue", receivingStoreId, "make.it.Hello");
Assert.That(value, Is.EqualTo("")); 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 receivingStoreId = (UUID)InvokeOp("JsonCreateStore", "{ 'make' : { 'it' : 'so' } }");
UUID readNotecardRequestId = (UUID)InvokeOpOnHost("JsonReadNotecard", so.UUID, receivingStoreId, "make.it", notecardName); UUID readNotecardRequestId = (UUID)InvokeOpOnHost("JsonReadNotecard", so.UUID, receivingStoreId, "make.it", notecardName);
Assert.That(readNotecardRequestId, Is.Not.EqualTo(UUID.Zero)); 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"); string value = (string)InvokeOp("JsonGetValue", receivingStoreId, "Hello");
Assert.That(value, Is.EqualTo("")); Assert.That(value, Is.EqualTo(""));
@ -395,6 +391,16 @@ namespace OpenSim.Region.OptionalModules.Scripting.JsonStore.Tests
Assert.That(value, Is.EqualTo("World")); 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. // Try read notecard to fake store.
UUID fakeStoreId = TestHelpers.ParseTail(0x500); UUID fakeStoreId = TestHelpers.ParseTail(0x500);