aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Framework/Communications/Tests/LoginServiceTests.cs
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Framework/Communications/Tests/LoginServiceTests.cs')
-rw-r--r--OpenSim/Framework/Communications/Tests/LoginServiceTests.cs45
1 files changed, 33 insertions, 12 deletions
diff --git a/OpenSim/Framework/Communications/Tests/LoginServiceTests.cs b/OpenSim/Framework/Communications/Tests/LoginServiceTests.cs
index a2a388e..7fda38c 100644
--- a/OpenSim/Framework/Communications/Tests/LoginServiceTests.cs
+++ b/OpenSim/Framework/Communications/Tests/LoginServiceTests.cs
@@ -103,7 +103,10 @@ namespace OpenSim.Framework.Communications.Tests
103 103
104 XmlRpcRequest request = new XmlRpcRequest("login_to_simulator", sendParams); 104 XmlRpcRequest request = new XmlRpcRequest("login_to_simulator", sendParams);
105 105
106 XmlRpcResponse response = loginService.XmlRpcLoginMethod(request, new IPEndPoint(Util.GetLocalHost(), 80)); 106 IPAddress tmpLocal = Util.GetLocalHost();
107 IPEndPoint tmpEnd = new IPEndPoint(tmpLocal, 80);
108 XmlRpcResponse response = m_loginService.XmlRpcLoginMethod(request, tmpEnd);
109
107 Hashtable responseData = (Hashtable)response.Value; 110 Hashtable responseData = (Hashtable)response.Value;
108 111
109 Assert.That(responseData["first_name"], Is.EqualTo(m_firstName)); 112 Assert.That(responseData["first_name"], Is.EqualTo(m_firstName));
@@ -113,7 +116,7 @@ namespace OpenSim.Framework.Communications.Tests
113 116
114 Regex capsSeedPattern 117 Regex capsSeedPattern
115 = new Regex("^http://" 118 = new Regex("^http://"
116 + m_regionExternalName 119 + NetworkUtil.GetHostFor(tmpLocal, m_regionExternalName)
117 + ":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]{12}0000/$"); 120 + ":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]{12}0000/$");
118 121
119 Assert.That(capsSeedPattern.IsMatch((string)responseData["seed_capability"]), Is.True); 122 Assert.That(capsSeedPattern.IsMatch((string)responseData["seed_capability"]), Is.True);
@@ -140,7 +143,10 @@ namespace OpenSim.Framework.Communications.Tests
140 143
141 XmlRpcRequest request = new XmlRpcRequest("login_to_simulator", sendParams); 144 XmlRpcRequest request = new XmlRpcRequest("login_to_simulator", sendParams);
142 145
143 XmlRpcResponse response = m_loginService.XmlRpcLoginMethod(request, new IPEndPoint(Util.GetLocalHost(), 80)); 146 IPAddress tmpLocal = Util.GetLocalHost();
147 IPEndPoint tmpEnd = new IPEndPoint(tmpLocal, 80);
148 XmlRpcResponse response = m_loginService.XmlRpcLoginMethod(request, tmpEnd);
149
144 Hashtable responseData = (Hashtable)response.Value; 150 Hashtable responseData = (Hashtable)response.Value;
145 151
146 UserAgentData uagent = m_userProfileData.CurrentAgent; 152 UserAgentData uagent = m_userProfileData.CurrentAgent;
@@ -163,7 +169,7 @@ namespace OpenSim.Framework.Communications.Tests
163 169
164 Regex capsSeedPattern 170 Regex capsSeedPattern
165 = new Regex("^http://" 171 = new Regex("^http://"
166 + m_regionExternalName 172 + NetworkUtil.GetHostFor(tmpLocal, m_regionExternalName)
167 + ":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]{12}0000/$"); 173 + ":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]{12}0000/$");
168 174
169 Assert.That(capsSeedPattern.IsMatch((string)responseData["seed_capability"]), Is.True); 175 Assert.That(capsSeedPattern.IsMatch((string)responseData["seed_capability"]), Is.True);
@@ -194,14 +200,16 @@ namespace OpenSim.Framework.Communications.Tests
194 200
195 XmlRpcRequest request = new XmlRpcRequest("login_to_simulator", sendParams); 201 XmlRpcRequest request = new XmlRpcRequest("login_to_simulator", sendParams);
196 202
197 XmlRpcResponse response = m_loginService.XmlRpcLoginMethod(request, new IPEndPoint(Util.GetLocalHost(), 80)); 203 IPAddress tmpLocal = Util.GetLocalHost();
204 IPEndPoint tmpEnd = new IPEndPoint(tmpLocal, 80);
205 XmlRpcResponse response = m_loginService.XmlRpcLoginMethod(request, tmpEnd);
206
198 Hashtable responseData = (Hashtable)response.Value; 207 Hashtable responseData = (Hashtable)response.Value;
199 208
200 ArrayList friendslist = (ArrayList) responseData["buddy-list"]; 209 ArrayList friendslist = (ArrayList) responseData["buddy-list"];
201 210
202 Assert.That(friendslist,Is.Not.Null); 211 Assert.That(friendslist,Is.Not.Null);
203 212
204
205 Hashtable buddy1 = (Hashtable) friendslist[0]; 213 Hashtable buddy1 = (Hashtable) friendslist[0];
206 Hashtable buddy2 = (Hashtable) friendslist[1]; 214 Hashtable buddy2 = (Hashtable) friendslist[1];
207 Assert.That(friendslist.Count, Is.EqualTo(2)); 215 Assert.That(friendslist.Count, Is.EqualTo(2));
@@ -231,7 +239,10 @@ namespace OpenSim.Framework.Communications.Tests
231 239
232 XmlRpcRequest request = new XmlRpcRequest("login_to_simulator", sendParams); 240 XmlRpcRequest request = new XmlRpcRequest("login_to_simulator", sendParams);
233 241
234 XmlRpcResponse response = m_loginService.XmlRpcLoginMethod(request, new IPEndPoint(Util.GetLocalHost(), 80)); 242 IPAddress tmpLocal = Util.GetLocalHost();
243 IPEndPoint tmpEnd = new IPEndPoint(tmpLocal, 80);
244 XmlRpcResponse response = m_loginService.XmlRpcLoginMethod(request, tmpEnd);
245
235 Hashtable responseData = (Hashtable)response.Value; 246 Hashtable responseData = (Hashtable)response.Value;
236 Assert.That(responseData["message"], Is.EqualTo(error_auth_message)); 247 Assert.That(responseData["message"], Is.EqualTo(error_auth_message));
237 248
@@ -256,7 +267,10 @@ namespace OpenSim.Framework.Communications.Tests
256 267
257 XmlRpcRequest request = new XmlRpcRequest("login_to_simulator", sendParams); 268 XmlRpcRequest request = new XmlRpcRequest("login_to_simulator", sendParams);
258 269
259 XmlRpcResponse response = m_loginService.XmlRpcLoginMethod(request, new IPEndPoint(Util.GetLocalHost(), 80)); 270 IPAddress tmpLocal = Util.GetLocalHost();
271 IPEndPoint tmpEnd = new IPEndPoint(tmpLocal, 80);
272 XmlRpcResponse response = m_loginService.XmlRpcLoginMethod(request, tmpEnd);
273
260 Hashtable responseData = (Hashtable)response.Value; 274 Hashtable responseData = (Hashtable)response.Value;
261 Assert.That(responseData["message"], Is.EqualTo(error_auth_message)); 275 Assert.That(responseData["message"], Is.EqualTo(error_auth_message));
262 276
@@ -281,7 +295,10 @@ namespace OpenSim.Framework.Communications.Tests
281 295
282 XmlRpcRequest request = new XmlRpcRequest("login_to_simulator", sendParams); 296 XmlRpcRequest request = new XmlRpcRequest("login_to_simulator", sendParams);
283 297
284 XmlRpcResponse response = m_loginService.XmlRpcLoginMethod(request, new IPEndPoint(Util.GetLocalHost(), 80)); 298 IPAddress tmpLocal = Util.GetLocalHost();
299 IPEndPoint tmpEnd = new IPEndPoint(tmpLocal, 80);
300 XmlRpcResponse response = m_loginService.XmlRpcLoginMethod(request, tmpEnd);
301
285 Hashtable responseData = (Hashtable)response.Value; 302 Hashtable responseData = (Hashtable)response.Value;
286 Assert.That(responseData["message"], Is.EqualTo(error_xml_message)); 303 Assert.That(responseData["message"], Is.EqualTo(error_xml_message));
287 304
@@ -312,20 +329,24 @@ namespace OpenSim.Framework.Communications.Tests
312 329
313 // First we log in. 330 // First we log in.
314 XmlRpcRequest request = new XmlRpcRequest("login_to_simulator", sendParams); 331 XmlRpcRequest request = new XmlRpcRequest("login_to_simulator", sendParams);
315 XmlRpcResponse response = m_loginService.XmlRpcLoginMethod(request, new IPEndPoint(Util.GetLocalHost(), 80)); 332
333 IPAddress tmpLocal = Util.GetLocalHost();
334 IPEndPoint tmpEnd = new IPEndPoint(tmpLocal, 80);
335 XmlRpcResponse response = m_loginService.XmlRpcLoginMethod(request, tmpEnd);
336
316 Hashtable responseData = (Hashtable)response.Value; 337 Hashtable responseData = (Hashtable)response.Value;
317 Assert.That(responseData["message"], Is.EqualTo("Hello folks")); 338 Assert.That(responseData["message"], Is.EqualTo("Hello folks"));
318 339
319 // Then we try again, this time expecting failure. 340 // Then we try again, this time expecting failure.
320 request = new XmlRpcRequest("login_to_simulator", sendParams); 341 request = new XmlRpcRequest("login_to_simulator", sendParams);
321 response = m_loginService.XmlRpcLoginMethod(request, new IPEndPoint(Util.GetLocalHost(), 80)); 342 response = m_loginService.XmlRpcLoginMethod(request, tmpEnd);
322 responseData = (Hashtable)response.Value; 343 responseData = (Hashtable)response.Value;
323 Assert.That(responseData["message"], Is.EqualTo(error_already_logged)); 344 Assert.That(responseData["message"], Is.EqualTo(error_already_logged));
324 345
325 // Finally the third time we should be able to get right back in. 346 // Finally the third time we should be able to get right back in.
326 request = new XmlRpcRequest("login_to_simulator", sendParams); 347 request = new XmlRpcRequest("login_to_simulator", sendParams);
327 348
328 response = m_loginService.XmlRpcLoginMethod(request, new IPEndPoint(Util.GetLocalHost(), 80)); 349 response = m_loginService.XmlRpcLoginMethod(request, tmpEnd);
329 responseData = (Hashtable)response.Value; 350 responseData = (Hashtable)response.Value;
330 Assert.That(responseData["message"], Is.EqualTo("Hello folks")); 351 Assert.That(responseData["message"], Is.EqualTo("Hello folks"));
331 352