Esempio 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)
Esempio 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)
Esempio 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()
Esempio 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()
Esempio 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()
Esempio 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)
Esempio 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)
Esempio 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)
Esempio 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)
Esempio 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()
Esempio 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()
Esempio 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()