def test_command_close_cancels_timer(self): cmd = Command('CMD', 'tag', loop=self.loop, timeout=1) cmd.close('line', 'OK') yield from self.advance(3) yield from cmd.wait() self.assertEqual(Response('OK', ['line']), cmd.response)
def test_command_timeout_while_receiving_data(self): cmd = Command('CMD', 'tag', loop=self.loop, timeout=2) yield from self.advance(1) cmd.begin_literal_data('literal', 12) yield from self.advance(3) with self.assertRaises(asyncio.TimeoutError): yield from cmd.wait()
def test_command_timeout_while_receiving_data(self): cmd = Command('CMD', 'tag', loop=self.loop, timeout=2) yield from self.advance(1) cmd.begin_literal_data(12, b'literal') yield from self.advance(3) with self.assertRaises(AioImapException): yield from cmd.wait()
def test_command_append_to_resp_resets_timer(self): cmd = Command('CMD', 'tag', loop=self.loop, timeout=2) yield from self.advance(1.9) cmd.append_to_resp('line 1') yield from self.advance(1.9) cmd.close('line 2', 'OK') yield from cmd.wait() self.assertEqual(Response('OK', ['line 1', 'line 2']), cmd.response)
def test_command_begin_literal_data_resets_timer(self): cmd = Command('CMD', 'tag', loop=self.loop, timeout=2) yield from self.advance(1) cmd.begin_literal_data(b'literal', 12) yield from self.advance(1.9) cmd.close('line', 'OK') yield from cmd.wait() self.assertEqual(Response('OK', ['line']), cmd.response)
def test_command_begin_literal_data_resets_timer(self): cmd = Command('CMD', 'tag', loop=self.loop, timeout=2) yield from self.advance(1) cmd.begin_literal_data(7, b'literal') yield from self.advance(1.9) cmd.close('line', 'OK') yield from cmd.wait() self.assertEqual(Response('OK', [b'literal', 'line']), cmd.response)
def test_command_timeout(self): cmd = Command('CMD', 'tag', loop=self.loop, timeout=1) yield from self.advance(2) with self.assertRaises(asyncio.TimeoutError): yield from cmd.wait()
def test_command_timeout(self): cmd = Command('CMD', 'tag', loop=self.loop, timeout=1) yield from self.advance(2) with self.assertRaises(AioImapException): yield from cmd.wait()