tests: Fix tests
This commit is contained in:
parent
67446285c1
commit
473f8e4bb6
@ -1,5 +1,6 @@
|
||||
import 'dart:async';
|
||||
import 'package:moxxmpp/src/jid.dart';
|
||||
import 'package:moxxmpp/src/managers/attributes.dart';
|
||||
import 'package:moxxmpp/src/managers/base.dart';
|
||||
import 'package:moxxmpp/src/managers/data.dart';
|
||||
import 'package:moxxmpp/src/managers/handlers.dart';
|
||||
@ -66,11 +67,17 @@ class RosterFeatureNegotiator extends XmppFeatureNegotiatorBase {
|
||||
|
||||
/// This manager requires a RosterFeatureNegotiator to be registered.
|
||||
class RosterManager extends XmppManagerBase {
|
||||
RosterManager(this._stateManager) : super() {
|
||||
_stateManager.register(getAttributes().sendEvent);
|
||||
}
|
||||
RosterManager(this._stateManager) : super();
|
||||
|
||||
/// The class managing the entire roster state.
|
||||
final BaseRosterStateManager _stateManager;
|
||||
|
||||
@override
|
||||
void register(XmppManagerAttributes attributes) {
|
||||
super.register(attributes);
|
||||
_stateManager.register(attributes.sendEvent);
|
||||
}
|
||||
|
||||
@override
|
||||
String getId() => rosterManager;
|
||||
|
||||
|
@ -61,7 +61,7 @@ void main() {
|
||||
])
|
||||
..registerManagers([
|
||||
PresenceManager('http://moxxmpp.example'),
|
||||
RosterManager(),
|
||||
RosterManager(TestingRosterStateManager('', [])),
|
||||
DiscoManager(),
|
||||
PingManager(),
|
||||
])
|
||||
|
@ -243,7 +243,7 @@ void main() {
|
||||
final sm = StreamManagementManager();
|
||||
conn.registerManagers([
|
||||
PresenceManager('http://moxxmpp.example'),
|
||||
RosterManager(),
|
||||
RosterManager(TestingRosterStateManager('', [])),
|
||||
DiscoManager(),
|
||||
PingManager(),
|
||||
sm,
|
||||
@ -365,7 +365,7 @@ void main() {
|
||||
final sm = StreamManagementManager();
|
||||
conn.registerManagers([
|
||||
PresenceManager('http://moxxmpp.example'),
|
||||
RosterManager(),
|
||||
RosterManager(TestingRosterStateManager('', [])),
|
||||
DiscoManager(),
|
||||
PingManager(),
|
||||
sm,
|
||||
@ -519,7 +519,7 @@ void main() {
|
||||
),);
|
||||
conn.registerManagers([
|
||||
PresenceManager('http://moxxmpp.example'),
|
||||
RosterManager(),
|
||||
RosterManager(TestingRosterStateManager('', [])),
|
||||
DiscoManager(),
|
||||
PingManager(),
|
||||
StreamManagementManager(),
|
||||
@ -611,7 +611,7 @@ void main() {
|
||||
),);
|
||||
conn.registerManagers([
|
||||
PresenceManager('http://moxxmpp.example'),
|
||||
RosterManager(),
|
||||
RosterManager(TestingRosterStateManager('', [])),
|
||||
DiscoManager(),
|
||||
PingManager(),
|
||||
StreamManagementManager(),
|
||||
@ -703,7 +703,7 @@ void main() {
|
||||
),);
|
||||
conn.registerManagers([
|
||||
PresenceManager('http://moxxmpp.example'),
|
||||
RosterManager(),
|
||||
RosterManager(TestingRosterStateManager('', [])),
|
||||
DiscoManager(),
|
||||
PingManager(),
|
||||
StreamManagementManager(),
|
||||
|
@ -7,7 +7,7 @@ import 'helpers/xmpp.dart';
|
||||
/// Returns true if the roster manager triggeres an event for a given stanza
|
||||
Future<bool> testRosterManager(String bareJid, String resource, String stanzaString) async {
|
||||
var eventTriggered = false;
|
||||
final roster = RosterManager();
|
||||
final roster = RosterManager(TestingRosterStateManager('', []));
|
||||
roster.register(XmppManagerAttributes(
|
||||
sendStanza: (_, { StanzaFromType addFrom = StanzaFromType.full, bool addId = true, bool retransmitted = false, bool awaitable = true, bool encrypted = false }) async => XMLNode(tag: 'hallo'),
|
||||
sendEvent: (event) {
|
||||
@ -127,7 +127,7 @@ void main() {
|
||||
),);
|
||||
conn.registerManagers([
|
||||
PresenceManager('http://moxxmpp.example'),
|
||||
RosterManager(),
|
||||
RosterManager(TestingRosterStateManager('', [])),
|
||||
DiscoManager(),
|
||||
PingManager(),
|
||||
StreamManagementManager(),
|
||||
@ -181,7 +181,7 @@ void main() {
|
||||
),);
|
||||
conn.registerManagers([
|
||||
PresenceManager('http://moxxmpp.example'),
|
||||
RosterManager(),
|
||||
RosterManager(TestingRosterStateManager('', [])),
|
||||
DiscoManager(),
|
||||
PingManager(),
|
||||
]);
|
||||
@ -235,7 +235,7 @@ void main() {
|
||||
),);
|
||||
conn.registerManagers([
|
||||
PresenceManager('http://moxxmpp.example'),
|
||||
RosterManager(),
|
||||
RosterManager(TestingRosterStateManager('', [])),
|
||||
DiscoManager(),
|
||||
PingManager(),
|
||||
]);
|
||||
@ -290,7 +290,7 @@ void main() {
|
||||
),);
|
||||
conn.registerManagers([
|
||||
PresenceManager('http://moxxmpp.example'),
|
||||
RosterManager(),
|
||||
RosterManager(TestingRosterStateManager('', [])),
|
||||
DiscoManager(),
|
||||
PingManager(),
|
||||
]);
|
||||
@ -308,7 +308,7 @@ void main() {
|
||||
group('Test roster pushes', () {
|
||||
test('Test for a CVE-2015-8688 style vulnerability', () async {
|
||||
var eventTriggered = false;
|
||||
final roster = RosterManager();
|
||||
final roster = RosterManager(TestingRosterStateManager('', []));
|
||||
roster.register(XmppManagerAttributes(
|
||||
sendStanza: (_, { StanzaFromType addFrom = StanzaFromType.full, bool addId = true, bool retransmitted = false, bool awaitable = true, bool encrypted = false }) async => XMLNode(tag: 'hallo'),
|
||||
sendEvent: (event) {
|
||||
|
Loading…
Reference in New Issue
Block a user