예제 #1
0
    def test_fetch_with_litteral(self):
        fetch = FetchCommand('TAG')
        fetch.append_to_resp('12 FETCH (FLAGS () BODY[] {13}')
        fetch.begin_literal_data(13, b'literal (data')
        fetch.append_to_resp(')')

        self.assertFalse(fetch.wait_data())
예제 #2
0
    def test_fetch_with_litteral(self):
        fetch = FetchCommand('TAG')
        fetch.append_to_resp('12 FETCH (FLAGS () BODY[] {13}')
        fetch.begin_literal_data(13, b'literal (data')
        fetch.append_to_resp(')')

        self.assertFalse(fetch.wait_data())
예제 #3
0
    def test_simple_fetch_with_two_lines(self):
        fetch = FetchCommand('TAG')
        fetch.append_to_resp('12 FETCH (FLAGS (\Seen) BODY ("TEXT" "PLAIN" ("CHARSET" "US-ASCII") NIL NIL "7BIT" 3028')
        self.assertTrue(fetch.wait_data())

        fetch.append_to_resp('92))')
        self.assertFalse(fetch.wait_data())
예제 #4
0
    def test_uncomplete_fetch_message_attributes_without_literal(self):
        cmd = FetchCommand('TAG')
        self.imap_protocol._handle_line = MagicMock(return_value=cmd)

        line = b'* 12 FETCH (FLAGS (\Seen) BODY ("TEXT" "PLAIN" ("CHARSET" "US-ASCII") NIL NIL "7BIT" 3028 \r\n'
        cmd.append_to_resp(line.decode())
        self.imap_protocol.data_received(line)
        line = b'92))\r\nTAG OK FETCH completed\r\n'
        cmd.append_to_resp(line.decode())
        self.imap_protocol.data_received(line)

        self.imap_protocol._handle_line.assert_has_calls(
            [call('* 12 FETCH (FLAGS (\Seen) BODY ("TEXT" "PLAIN" ("CHARSET" "US-ASCII") NIL NIL "7BIT" 3028 ', None),
             call('92))', cmd), call('TAG OK FETCH completed', None)])
예제 #5
0
    def test_fetch_only_the_last_message_data(self):
        fetch = FetchCommand('TAG')
        fetch.append_to_resp('12 FETCH (FLAGS (\Seen)') # not closed on purpose
        self.assertTrue(fetch.wait_data())

        fetch.append_to_resp('13 FETCH (FLAGS (\Seen)')
        self.assertTrue(fetch.wait_data())

        fetch.append_to_resp(')')
        self.assertFalse(fetch.wait_data())
예제 #6
0
    def test_simple_fetch(self):
        fetch = FetchCommand('TAG')
        fetch.append_to_resp('12 FETCH (FLAGS (\Seen))')

        self.assertFalse(fetch.wait_data())
예제 #7
0
    def test_simple_fetch(self):
        fetch = FetchCommand('TAG')
        fetch.append_to_resp('12 FETCH (FLAGS (\Seen))')

        self.assertFalse(fetch.wait_data())