# HG changeset patch # User souliane # Date 1453202309 -3600 # Node ID e79eedd9c56ab2c7e0df4dbf385790c66130d6e6 # Parent 73465c02045523f5ea8d83ac0ac0f72bc688bce1 test (RSM): fix according to modification in sat.tmp.wokkel: - parse has been renamed to fromElement in rev 1771 (54f834e40341) - use RSMResponse directly instead of ext_data in rev 1773 (777b4e63fc8a) diff -r 73465c020455 -r e79eedd9c56a wokkel/test/test_rsm.py --- a/wokkel/test/test_rsm.py Fri Jan 08 18:54:23 2016 +0100 +++ b/wokkel/test/test_rsm.py Tue Jan 19 12:18:29 2016 +0100 @@ -50,7 +50,7 @@ """ - request = RSMRequest.parse(parseXml(xml)) + request = RSMRequest.fromElement(parseXml(xml)) self.assertEqual(1, request.max) self.assertIdentical(None, request.index) self.assertIdentical(None, request.after) @@ -69,7 +69,7 @@ """ - request = RSMRequest.parse(parseXml(xml)) + request = RSMRequest.fromElement(parseXml(xml)) self.assertEqual(3, request.max) self.assertIdentical(None, request.index) self.assertEqual(u'peterpan@neverland.lit', request.after) @@ -88,7 +88,7 @@ """ - request = RSMRequest.parse(parseXml(xml)) + request = RSMRequest.fromElement(parseXml(xml)) self.assertEqual(5, request.max) self.assertIdentical(None, request.index) self.assertIdentical(None, request.after) @@ -107,7 +107,7 @@ """ - request = RSMRequest.parse(parseXml(xml)) + request = RSMRequest.fromElement(parseXml(xml)) self.assertEqual(7, request.max) self.assertIdentical(None, request.index) self.assertIdentical(None, request.after) @@ -126,7 +126,7 @@ """ - request = RSMRequest.parse(parseXml(xml)) + request = RSMRequest.fromElement(parseXml(xml)) self.assertEqual(9, request.max) self.assertEqual(371, request.index) self.assertIdentical(None, request.after) @@ -144,7 +144,7 @@ """ - request = RSMRequest.parse(parseXml(xml)) + request = RSMRequest.fromElement(parseXml(xml)) self.assertEqual(0, request.max) self.assertIdentical(None, request.index) self.assertIdentical(None, request.after) @@ -252,7 +252,7 @@ """ - response = RSMResponse.parse(parseXml(xml)) + response = RSMResponse.fromElement(parseXml(xml)) self.assertEqual(800, response.count) self.assertEqual(20, response.index) self.assertEqual(u'stpeter@jabber.org', response.first) @@ -269,7 +269,7 @@ """ - response = RSMResponse.parse(parseXml(xml)) + response = RSMResponse.fromElement(parseXml(xml)) self.assertEqual(800, response.count) self.assertIdentical(None, response.first) self.assertIdentical(None, response.last) @@ -320,16 +320,15 @@ """ Test sending items request to get the first page. """ - def cb(items): + def cb(response): + items, rsm = response self.assertEquals(2, len(items)) self.assertEquals([item1, item2], items) - rsm = self.protocol.getRSMResponse(ext_data['id']) self.assertDictEqual(rsm, {'count': '800', 'index': '0', 'first': 'item1', 'last': 'item2'}) - ext_data = {'id': unicode(uuid.uuid4()), 'rsm': RSMRequest(2)} d = self.protocol.items(JID('pubsub.example.org'), 'test', - ext_data=ext_data) + rsm_request=RSMRequest(2)) d.addCallback(cb) iq = self.stub.output[-1] @@ -366,17 +365,15 @@ """ Test sending items request to get the next page. """ - def cb(items): + def cb(response): + items, rsm = response self.assertEquals(2, len(items)) self.assertEquals([item1, item2], items) - rsm = self.protocol.getRSMResponse(ext_data['id']) self.assertDictEqual(rsm, {'count': '800', 'index': '2', 'first': 'item3', 'last': 'item4'}) - ext_data = {'id': unicode(uuid.uuid4()), - 'rsm': RSMRequest(2, after=u'item2')} d = self.protocol.items(JID('pubsub.example.org'), 'test', - ext_data=ext_data) + rsm_request=RSMRequest(2, after=u'item2')) d.addCallback(cb) iq = self.stub.output[-1] @@ -414,17 +411,15 @@ """ Test sending items request to get the previous page. """ - def cb(items): + def cb(response): + items, rsm = response self.assertEquals(2, len(items)) self.assertEquals([item1, item2], items) - rsm = self.protocol.getRSMResponse(ext_data['id']) self.assertDictEqual(rsm, {'count': '800', 'index': '0', 'first': 'item1', 'last': 'item2'}) - ext_data = {'id': unicode(uuid.uuid4()), - 'rsm': RSMRequest(2, before=u'item3')} d = self.protocol.items(JID('pubsub.example.org'), 'test', - ext_data=ext_data) + rsm_request=RSMRequest(2, before=u'item3')) d.addCallback(cb) iq = self.stub.output[-1] @@ -462,16 +457,15 @@ """ Test sending items request to get a page out of order. """ - def cb(items): + def cb(response): + items, rsm = response self.assertEquals(3, len(items)) self.assertEquals([item1, item2, item3], items) - rsm = self.protocol.getRSMResponse(ext_data['id']) self.assertDictEqual(rsm, {'count': '800', 'index': '3', 'first': 'item4', 'last': 'item6'}) - ext_data = {'id': unicode(uuid.uuid4()), 'rsm': RSMRequest(3, 3)} d = self.protocol.items(JID('pubsub.example.org'), 'test', - ext_data=ext_data) + rsm_response=RSMRequest(3, 3)) d.addCallback(cb) iq = self.stub.output[-1] @@ -511,14 +505,13 @@ """ Test sending items request to count them. """ - def cb(items): + def cb(response): + items, rsm = response self.assertEquals(0, len(items)) - rsm = self.protocol.getRSMResponse(ext_data['id']) self.assertDictEqual(rsm, {'count': '800'}) - ext_data = {'id': unicode(uuid.uuid4()), 'rsm': RSMRequest(0)} d = self.protocol.items(JID('pubsub.example.org'), 'test', - ext_data=ext_data) + rsm_request=RSMRequest(0)) d.addCallback(cb) iq = self.stub.output[-1]