Exemplo n.º 1
0
    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)
Exemplo n.º 2
0
    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)
Exemplo n.º 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('literal', 12)

        yield from self.advance(3)
        with self.assertRaises(asyncio.TimeoutError):
            yield from cmd.wait()
Exemplo n.º 4
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()
Exemplo n.º 5
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()
Exemplo n.º 6
0
    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)
Exemplo n.º 7
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)
Exemplo n.º 8
0
    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)
Exemplo n.º 9
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)
Exemplo n.º 10
0
 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()
Exemplo n.º 11
0
 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()
Exemplo n.º 12
0
 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()