Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def test_no_support(self):
self.client._cached_capabilities = (b'BLAH',)
self.assertRaises(CapabilityError, self.client.sort, 'ARRIVAL')
def test_no_support(self):
self.client._cached_capabilities = (b'IMAP4rev1',)
self.assertRaises(CapabilityError, self.client.id_)
def test_unsupported_algorithm(self):
self.client._cached_capabilities = (b'THREAD=FOO',)
self.assertRaises(CapabilityError, self.client.thread)
def test_no_thread_support(self):
self.client._cached_capabilities = (b'NOT-THREAD',)
self.assertRaises(CapabilityError, self.client.thread)
def wrapper(client, *args, **kwargs):
if not client.has_capability(capability):
raise exceptions.CapabilityError(
'Server does not support {} capability'.format(capability)
)
return func(client, *args, **kwargs)
Each returned thread is a list of messages ids. An example
return value containing three message threads::
((1, 2), (3,), (4, 5, 6))
The optional *algorithm* argument specifies the threading
algorithm to use.
The *criteria* and *charset* arguments are as per
:py:meth:`.search`.
See :rfc:`5256` for more details.
"""
algorithm = to_bytes(algorithm)
if not self.has_capability(b'THREAD=' + algorithm):
raise exceptions.CapabilityError(
'The server does not support %s threading algorithm' % algorithm
)
args = [algorithm, to_bytes(charset)] + \
_normalise_search_criteria(criteria, charset)
data = self._raw_command_untagged(b'THREAD', args)
return parse_response(data)