Example #1
0
    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()
Example #2
0
    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()
Example #3
0
    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()
Example #4
0
    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)
Example #5
0
    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)
    async def test_command_append_data_resets_timer(self):
        cmd = Command('CMD', 'tag', loop=self.loop, timeout=2)
        cmd.begin_literal_data(4, b'da')

        await self.advance(1.9)
        cmd.append_literal_data(b'ta')

        await self.advance(1.9)
        cmd.close('line', 'OK')

        await cmd.wait()
        self.assertEqual(Response('OK', [b'data', 'line']), cmd.response)