Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def test_split_responses_with_message_data_expunge(self):
self.assertEquals([b'* 123 EXPUNGE', b'TAG OK SELECT completed.'],
_split_responses(b'* 123 EXPUNGE\r\nTAG OK SELECT completed.\r\n'))
def test_split_responses_regular_lines(self):
self.assertEquals([b'* BYE Logging out', b'CAPB2 OK LOGOUT completed'],
_split_responses(b'* BYE Logging out\r\nCAPB2 OK LOGOUT completed\r\n'))
def test_split_responses_with_message_data(self):
self.assertEquals([b'* FETCH ...\r\n(mail content)\r\n...\r\n)',
b'TAG OK FETCH completed.'],
_split_responses(
b'* 1 FETCH (UID 1 RFC822 {26}\r\n...\r\n(mail content)\r\n...\r\n)\r\n'
b'TAG OK FETCH completed.'))
def test_split_responses_no_data(self):
self.assertEquals([], _split_responses(b''))
def test_split_responses_with_flag_fetch_message_data(self):
self.assertEquals([b'* 1 FETCH (UID 10 FLAGS (FOO))',
b'* 1 FETCH (UID 15 FLAGS (BAR))',
b'TAG OK STORE completed.'],
_split_responses(b'* 1 FETCH (UID 10 FLAGS (FOO))\r\n'
b'* 1 FETCH (UID 15 FLAGS (BAR))\r\n'
def test_split_responses_with_two_messages_data(self):
self.assertEquals([b'* FETCH mail 1\r\n)',
b'* FETCH mail 2\r\n)',
b'TAG OK FETCH completed.'],
_split_responses(
b'* 3 FETCH (UID 3 RFC822 {8}\r\nmail 1\r\n)\r\n'
b'* 4 FETCH (UID 4 RFC822 {8}\r\nmail 2\r\n)\r\n'