Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def setUp(self):
self.m_manager = mock.Mock()
self.m_endpoint = mock.Mock()
pages = [
[mock.Mock(id='foo'), mock.Mock(id='bar')],
[mock.Mock(id='baz'), mock.Mock(id='qux')],
]
self.m_endpoint.side_effect = pages
self.messages = pagers.MessageList(self.m_manager, self.m_endpoint)
def list(self, before_id=None, since_id=None, **kwargs):
"""Return a page of direct messages.
The messages come in reversed order (newest first). Note you can only
provide _one_ of ``before_id``, ``since_id``.
:param str before_id: message ID for paging backwards
:param str since_id: message ID for most recent messages since
:return: direct messages
:rtype: :class:`~groupy.pagers.MessageList`
"""
return pagers.MessageList(self, self._raw_list, before_id=before_id,
since_id=since_id, **kwargs)
def list(self, **params):
return pagers.MessageList(self, **params)