* Add seed cap check to login test

0.6.2-post-fixes
Justin Clarke Casey 2009-01-05 18:30:56 +00:00
parent 0d3a99f6bc
commit fcab408cc4
2 changed files with 16 additions and 6 deletions

View File

@ -28,6 +28,7 @@
using System; using System;
using System.Collections; using System.Collections;
using System.Net; using System.Net;
using System.Text.RegularExpressions;
using NUnit.Framework; using NUnit.Framework;
using NUnit.Framework.SyntaxHelpers; using NUnit.Framework.SyntaxHelpers;
using Nwc.XmlRpc; using Nwc.XmlRpc;
@ -45,7 +46,7 @@ namespace OpenSim.Framework.Communications.Tests
public class LoginServiceTests public class LoginServiceTests
{ {
/// <summary> /// <summary>
/// Test the normal response to a login. Does not test authentication. Doesn't yet do what it says on the tin. /// Test the normal response to a login. Does not test authentication.
/// </summary> /// </summary>
[Test] [Test]
public void TestNormalLoginResponse() public void TestNormalLoginResponse()
@ -54,12 +55,14 @@ namespace OpenSim.Framework.Communications.Tests
string firstName = "Timmy"; string firstName = "Timmy";
string lastName = "Mallet"; string lastName = "Mallet";
string regionExternalName = "localhost";
IPEndPoint capsEndPoint = new IPEndPoint(IPAddress.Loopback, 9123);
CommunicationsManager commsManager CommunicationsManager commsManager
= new TestCommunicationsManager(new OpenSim.Framework.NetworkServersInfo(42, 43)); = new TestCommunicationsManager(new OpenSim.Framework.NetworkServersInfo(42, 43));
commsManager.GridService.RegisterRegion( commsManager.GridService.RegisterRegion(
new RegionInfo(42, 43, new IPEndPoint(IPAddress.Loopback, 9000), "localhost")); new RegionInfo(42, 43, capsEndPoint, regionExternalName));
commsManager.GridService.RegionLoginsEnabled = true; commsManager.GridService.RegionLoginsEnabled = true;
LoginService loginService LoginService loginService
@ -84,10 +87,17 @@ namespace OpenSim.Framework.Communications.Tests
// TODO: Not check inventory part of response yet. // TODO: Not check inventory part of response yet.
// TODO: Not checking all of login response thoroughly yet. // TODO: Not checking all of login response thoroughly yet.
Assert.That(
responseData["circuit_code"], Is.GreaterThanOrEqualTo(0) & Is.LessThanOrEqualTo(System.Int32.MaxValue));
Assert.That(responseData["first_name"], Is.EqualTo(firstName)); Assert.That(responseData["first_name"], Is.EqualTo(firstName));
Assert.That(responseData["last_name"], Is.EqualTo(lastName)); Assert.That(responseData["last_name"], Is.EqualTo(lastName));
Assert.That(
responseData["circuit_code"], Is.GreaterThanOrEqualTo(0) & Is.LessThanOrEqualTo(System.Int32.MaxValue));
Regex capsSeedPattern
= new Regex("^http://"
+ regionExternalName
+ ":9000/CAPS/[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{8}0000/$");
Assert.That(capsSeedPattern.IsMatch((string)responseData["seed_capability"]), Is.True);
} }
} }
} }

View File

@ -312,7 +312,7 @@ namespace OpenSim.Region.Communications.Local
seedcap = "http://" + regionInfo.ExternalHostName + ":" + serversInfo.HttpListenerPort + "/CAPS/" + capsPath + "0000/"; seedcap = "http://" + regionInfo.ExternalHostName + ":" + serversInfo.HttpListenerPort + "/CAPS/" + capsPath + "0000/";
} }
response.SeedCapability = seedcap; //regionInfo.ExternalEndPoint.Address.ToString() + ":" + regionInfo.HttpPort + "/CAPS/" + capsPath + "0000/"; response.SeedCapability = seedcap;
// Notify the target of an incoming user // Notify the target of an incoming user
m_log.InfoFormat( m_log.InfoFormat(