aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/Tests
diff options
context:
space:
mode:
authorJustin Clark-Casey (justincc)2014-03-07 01:04:40 +0000
committerJustin Clark-Casey (justincc)2014-03-07 01:04:54 +0000
commit71918eeab4beee076d53469e8d19addab49135b7 (patch)
treea81a76fa046ffa1cada2e6759553ff3fde815edb /OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/Tests
parentAdd scene name to bad parcel add logging (diff)
downloadopensim-SC-71918eeab4beee076d53469e8d19addab49135b7.zip
opensim-SC-71918eeab4beee076d53469e8d19addab49135b7.tar.gz
opensim-SC-71918eeab4beee076d53469e8d19addab49135b7.tar.bz2
opensim-SC-71918eeab4beee076d53469e8d19addab49135b7.tar.xz
Add regression test for sending group notices via xmlrpc groups connector.
Diffstat (limited to 'OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/Tests')
-rw-r--r--OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/Tests/GroupsModuleTests.cs55
1 files changed, 55 insertions, 0 deletions
diff --git a/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/Tests/GroupsModuleTests.cs b/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/Tests/GroupsModuleTests.cs
index 26d2597..08a93b8 100644
--- a/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/Tests/GroupsModuleTests.cs
+++ b/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/Tests/GroupsModuleTests.cs
@@ -27,6 +27,7 @@
27 27
28using System; 28using System;
29using System.Collections; 29using System.Collections;
30using System.Collections.Generic;
30using System.Net; 31using System.Net;
31using System.Reflection; 32using System.Reflection;
32using Nini.Config; 33using Nini.Config;
@@ -118,5 +119,59 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups.Tests
118 119
119 // TODO: More checking of more actual event data. 120 // TODO: More checking of more actual event data.
120 } 121 }
122
123 [Test]
124 public void TestSendGroupNotice()
125 {
126 TestHelpers.InMethod();
127// TestHelpers.EnableLogging();
128
129 TestScene scene = new SceneHelpers().SetupScene();
130 IConfigSource configSource = new IniConfigSource();
131 IConfig config = configSource.AddConfig("Groups");
132 config.Set("Enabled", true);
133 config.Set("Module", "GroupsModule");
134 config.Set("DebugEnabled", true);
135
136 GroupsModule gm = new GroupsModule();
137
138 SceneHelpers.SetupSceneModules(scene, configSource, gm, new MockGroupsServicesConnector());
139
140 UUID userId = TestHelpers.ParseTail(0x1);
141 string subjectText = "newman";
142 string messageText = "Hello";
143 string combinedSubjectMessage = string.Format("{0}|{1}", subjectText, messageText);
144
145 ScenePresence sp = SceneHelpers.AddScenePresence(scene, TestHelpers.ParseTail(0x1));
146 TestClient tc = (TestClient)sp.ControllingClient;
147
148 UUID groupID = gm.CreateGroup(tc, "group1", null, true, UUID.Zero, 0, true, true, true);
149 gm.JoinGroupRequest(tc, groupID);
150
151 // Create a second user who doesn't want to receive notices
152 ScenePresence sp2 = SceneHelpers.AddScenePresence(scene, TestHelpers.ParseTail(0x2));
153 TestClient tc2 = (TestClient)sp2.ControllingClient;
154 gm.JoinGroupRequest(tc2, groupID);
155 gm.SetGroupAcceptNotices(tc2, groupID, false, true);
156
157 List<GridInstantMessage> spReceivedMessages = new List<GridInstantMessage>();
158 tc.OnReceivedInstantMessage += im => spReceivedMessages.Add(im);
159
160 List<GridInstantMessage> sp2ReceivedMessages = new List<GridInstantMessage>();
161 tc2.OnReceivedInstantMessage += im => sp2ReceivedMessages.Add(im);
162
163 GridInstantMessage noticeIm = new GridInstantMessage();
164 noticeIm.fromAgentID = userId.Guid;
165 noticeIm.toAgentID = groupID.Guid;
166 noticeIm.message = combinedSubjectMessage;
167 noticeIm.dialog = (byte)InstantMessageDialog.GroupNotice;
168
169 tc.HandleImprovedInstantMessage(noticeIm);
170
171 Assert.That(spReceivedMessages.Count, Is.EqualTo(1));
172 Assert.That(spReceivedMessages[0].message, Is.EqualTo(combinedSubjectMessage));
173
174 Assert.That(sp2ReceivedMessages.Count, Is.EqualTo(0));
175 }
121 } 176 }
122} \ No newline at end of file 177} \ No newline at end of file