* Fix unit tests so that they correctly handle 404 missing asset response
* I didn't think there were tests in this area - my bad0.6.6-post-fixes
parent
593942b195
commit
87097f2484
|
@ -94,9 +94,11 @@ namespace OpenSim.Framework.Servers.Tests
|
||||||
public void TestHandleFetchMissingAsset()
|
public void TestHandleFetchMissingAsset()
|
||||||
{
|
{
|
||||||
IAssetCache assetCache = new TestAssetCache();
|
IAssetCache assetCache = new TestAssetCache();
|
||||||
CachedGetAssetStreamHandler handler = new CachedGetAssetStreamHandler(assetCache);
|
CachedGetAssetStreamHandler handler;
|
||||||
|
OSHttpResponse response;
|
||||||
|
AssetBase asset = CreateTestEnvironment(out handler, out response);
|
||||||
|
|
||||||
GetAssetStreamHandlerTestHelpers.BaseFetchMissingAsset(handler);
|
GetAssetStreamHandlerTestHelpers.BaseFetchMissingAsset(handler, response);
|
||||||
}
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
|
|
|
@ -94,10 +94,11 @@ namespace OpenSim.Framework.Servers.Tests
|
||||||
[Test]
|
[Test]
|
||||||
public void TestHandleFetchMissingAsset()
|
public void TestHandleFetchMissingAsset()
|
||||||
{
|
{
|
||||||
IAssetDataPlugin assetDataPlugin = new TestAssetDataPlugin();
|
GetAssetStreamHandler handler;
|
||||||
GetAssetStreamHandler handler = new GetAssetStreamHandler(assetDataPlugin);
|
OSHttpResponse response;
|
||||||
|
AssetBase asset = CreateTestEnvironment(out handler, out response);
|
||||||
|
|
||||||
GetAssetStreamHandlerTestHelpers.BaseFetchMissingAsset(handler);
|
GetAssetStreamHandlerTestHelpers.BaseFetchMissingAsset(handler, response);
|
||||||
}
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
|
|
|
@ -80,8 +80,7 @@ namespace OpenSim.Tests.Common.Setup
|
||||||
|
|
||||||
public static void BaseFetchExistingAssetMetaDataTest(AssetBase asset, BaseGetAssetStreamHandler handler, OSHttpResponse response)
|
public static void BaseFetchExistingAssetMetaDataTest(AssetBase asset, BaseGetAssetStreamHandler handler, OSHttpResponse response)
|
||||||
{
|
{
|
||||||
XmlSerializer xs =
|
XmlSerializer xs = new XmlSerializer(typeof(AssetMetadata));
|
||||||
new XmlSerializer(typeof(AssetMetadata));
|
|
||||||
|
|
||||||
byte[] expected = ServerUtils.SerializeResult(xs, asset.Metadata);
|
byte[] expected = ServerUtils.SerializeResult(xs, asset.Metadata);
|
||||||
|
|
||||||
|
@ -112,9 +111,12 @@ namespace OpenSim.Tests.Common.Setup
|
||||||
return asset;
|
return asset;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void BaseFetchMissingAsset(BaseGetAssetStreamHandler handler)
|
public static void BaseFetchMissingAsset(BaseGetAssetStreamHandler handler, OSHttpResponse response)
|
||||||
{
|
{
|
||||||
Assert.AreEqual(BaseRequestHandlerTestHelper.EmptyByteArray, handler.Handle("/assets/" + Guid.NewGuid(), null, null, null), "Failed on bad guid.");
|
Assert.AreEqual(
|
||||||
|
BaseRequestHandlerTestHelper.EmptyByteArray,
|
||||||
|
handler.Handle("/assets/" + Guid.NewGuid(), null, null, response), "Failed on bad guid.");
|
||||||
|
Assert.AreEqual((int)HttpStatusCode.NotFound, response.StatusCode, "Response code wrong in BaseFetchMissingAsset");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue