From: Menno Smits Date: Mon, 19 Sep 2016 11:07:08 +0000 (+1200) Subject: Move the test for unquoted folders in STATUS X-Git-Url: http://git.khamidou.com/?a=commitdiff_plain;h=f994af6680d18442b54d8a7f4059f6c81d053413;p=imapclient.git Move the test for unquoted folders in STATUS It's now with the other folder_status tests. --- diff --git a/imapclient/test/test_folder_status.py b/imapclient/test/test_folder_status.py index 5bf2c73..fd85f02 100644 --- a/imapclient/test/test_folder_status.py +++ b/imapclient/test/test_folder_status.py @@ -4,6 +4,8 @@ from __future__ import unicode_literals +from mock import Mock + from .imapclient_test import IMAPClientTest @@ -39,3 +41,22 @@ class TestFolderStatus(IMAPClientTest): self.client._imap.status.assert_called_once_with(b'"foo"', '(UIDNEXT)') self.assertDictEqual(out, {b'UIDNEXT': 4}) + + def test_extra_response(self): + # In production, we've seen folder names containing spaces come back + # like this and be broken into two components in the tuple. + server_response = ["My files (UIDNEXT 24369)"] + mock = Mock(return_value=server_response) + self.client._command_and_check = mock + + resp = self.client.folder_status('My files', ['UIDNEXT']) + self.assertEqual(resp, {'UIDNEXT': 24369}) + + # We've also seen the response contain mailboxes we didn't + # ask for. In all known cases, the desired mailbox is last. + server_response = ["sent (UIDNEXT 24369)\nINBOX (UIDNEXT 24369)"] + mock = Mock(return_value=server_response) + self.client._command_and_check = mock + + resp = self.client.folder_status('INBOX', ['UIDNEXT']) + self.assertEqual(resp, {'UIDNEXT': 24369}) diff --git a/imapclient/test/test_imapclient.py b/imapclient/test/test_imapclient.py index 7fd2053..71d3867 100644 --- a/imapclient/test/test_imapclient.py +++ b/imapclient/test/test_imapclient.py @@ -146,27 +146,6 @@ class TestListFolders(IMAPClientTest): self.assertEqual(folders, [((br'\HasNoChildren',), b'/', 'last')]) -class TestFolderStatus(IMAPClientTest): - def test_extra_response(self): - # In production, we've seen folder names containing spaces come back - # like this and be broken into two components in the tuple. - server_response = ["My files (UIDNEXT 24369)"] - mock = Mock(return_value=server_response) - self.client._command_and_check = mock - - resp = self.client.folder_status('My files', ['UIDNEXT']) - self.assertEqual(resp, {'UIDNEXT': 24369}) - - # We've also seen the response contain mailboxes we didn't - # ask for. In all known cases, the desired mailbox is last. - server_response = ["sent (UIDNEXT 24369)\nINBOX (UIDNEXT 24369)"] - mock = Mock(return_value=server_response) - self.client._command_and_check = mock - - resp = self.client.folder_status('INBOX', ['UIDNEXT']) - self.assertEqual(resp, {'UIDNEXT': 24369}) - - class TestSelectFolder(IMAPClientTest): def test_normal(self):