From fcab408cc49508efb85d612029dee271a88d13d0 Mon Sep 17 00:00:00 2001 From: Justin Clarke Casey Date: Mon, 5 Jan 2009 18:30:56 +0000 Subject: * Add seed cap check to login test --- .../Communications/Tests/LoginServiceTests.cs | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) (limited to 'OpenSim/Framework') diff --git a/OpenSim/Framework/Communications/Tests/LoginServiceTests.cs b/OpenSim/Framework/Communications/Tests/LoginServiceTests.cs index 1e1fa73..2dc644a 100644 --- a/OpenSim/Framework/Communications/Tests/LoginServiceTests.cs +++ b/OpenSim/Framework/Communications/Tests/LoginServiceTests.cs @@ -28,6 +28,7 @@ using System; using System.Collections; using System.Net; +using System.Text.RegularExpressions; using NUnit.Framework; using NUnit.Framework.SyntaxHelpers; using Nwc.XmlRpc; @@ -43,9 +44,9 @@ namespace OpenSim.Framework.Communications.Tests /// [TestFixture] public class LoginServiceTests - { + { /// - /// 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. /// [Test] public void TestNormalLoginResponse() @@ -54,12 +55,14 @@ namespace OpenSim.Framework.Communications.Tests string firstName = "Timmy"; string lastName = "Mallet"; + string regionExternalName = "localhost"; + IPEndPoint capsEndPoint = new IPEndPoint(IPAddress.Loopback, 9123); CommunicationsManager commsManager = new TestCommunicationsManager(new OpenSim.Framework.NetworkServersInfo(42, 43)); commsManager.GridService.RegisterRegion( - new RegionInfo(42, 43, new IPEndPoint(IPAddress.Loopback, 9000), "localhost")); + new RegionInfo(42, 43, capsEndPoint, regionExternalName)); commsManager.GridService.RegionLoginsEnabled = true; LoginService loginService @@ -84,10 +87,17 @@ namespace OpenSim.Framework.Communications.Tests // TODO: Not check inventory part of response yet. // TODO: Not checking all of login response thoroughly yet. + Assert.That(responseData["first_name"], Is.EqualTo(firstName)); + Assert.That(responseData["last_name"], Is.EqualTo(lastName)); Assert.That( responseData["circuit_code"], Is.GreaterThanOrEqualTo(0) & Is.LessThanOrEqualTo(System.Int32.MaxValue)); - Assert.That(responseData["first_name"], Is.EqualTo(firstName)); - Assert.That(responseData["last_name"], Is.EqualTo(lastName)); + + 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); } } } -- cgit v1.1