summaryrefslogtreecommitdiff
path: root/service/test/unit/maintenance
diff options
context:
space:
mode:
authorJefferson Stachelski <jstachel@thoughtworks.com>2015-04-28 16:50:03 -0300
committerJefferson Stachelski <jstachel@thoughtworks.com>2015-04-29 16:26:33 -0300
commitb84432fc22063e5ce18c6e07d8e4daa89eb2d5c5 (patch)
tree0b7b8ce6efe77febc4169e3895ad5c5ea6d7de90 /service/test/unit/maintenance
parentc67d2a43dd65ac9526cf5db84b9e41ca3d0795d7 (diff)
#337 Fixed the indentation of test_commands
Diffstat (limited to 'service/test/unit/maintenance')
-rw-r--r--service/test/unit/maintenance/test_commands.py90
1 files changed, 45 insertions, 45 deletions
diff --git a/service/test/unit/maintenance/test_commands.py b/service/test/unit/maintenance/test_commands.py
index f23655d8..6c881cb9 100644
--- a/service/test/unit/maintenance/test_commands.py
+++ b/service/test/unit/maintenance/test_commands.py
@@ -27,66 +27,66 @@ from os.path import join, dirname
class TestCommands(unittest.TestCase):
- def setUp(self):
- self.leap_session = MagicMock(spec=LeapSession)
- self.soledad = MagicMock(spec=Soledad)
- self.account = MagicMock(spec=SoledadBackedAccount)
- self.mailbox = MagicMock()
- self.leap_session.account = self.account
- self.account.getMailbox.return_value = self.mailbox
+ def setUp(self):
+ self.leap_session = MagicMock(spec=LeapSession)
+ self.soledad = MagicMock(spec=Soledad)
+ self.account = MagicMock(spec=SoledadBackedAccount)
+ self.mailbox = MagicMock()
+ self.leap_session.account = self.account
+ self.account.getMailbox.return_value = self.mailbox
- self.args = (self.leap_session, self.soledad)
+ self.args = (self.leap_session, self.soledad)
- def test_delete_all_mails_supports_empty_doclist(self):
- self.soledad.get_all_docs.return_value = (1, [])
+ def test_delete_all_mails_supports_empty_doclist(self):
+ self.soledad.get_all_docs.return_value = (1, [])
- delete_all_mails(self.args)
+ delete_all_mails(self.args)
- self.assertFalse(self.soledad.delete_doc.called)
+ self.assertFalse(self.soledad.delete_doc.called)
- def test_delete_all_mails(self):
- doc = MagicMock(spec=SoledadDocument)
- doc.content = {'type': 'head'}
- self.soledad.get_all_docs.return_value = (1, [doc])
+ def test_delete_all_mails(self):
+ doc = MagicMock(spec=SoledadDocument)
+ doc.content = {'type': 'head'}
+ self.soledad.get_all_docs.return_value = (1, [doc])
- delete_all_mails(self.args)
+ delete_all_mails(self.args)
- self.soledad.delete_doc.assert_called_once_with(doc)
+ self.soledad.delete_doc.assert_called_once_with(doc)
- def test_only_mail_documents_are_deleted(self):
- docs = self._create_docs_of_type(['head', 'cnt', 'flags', 'mbx', 'foo', None])
- self.soledad.get_all_docs.return_value = (1, docs)
+ def test_only_mail_documents_are_deleted(self):
+ docs = self._create_docs_of_type(['head', 'cnt', 'flags', 'mbx', 'foo', None])
+ self.soledad.get_all_docs.return_value = (1, docs)
- delete_all_mails(self.args)
+ delete_all_mails(self.args)
- for doc in docs:
- if doc.content['type'] in ['head', 'cnt', 'flags']:
- self.soledad.delete_doc.assert_any_call(doc)
- self.assertEqual(3, len(self.soledad.delete_doc.mock_calls))
+ for doc in docs:
+ if doc.content['type'] in ['head', 'cnt', 'flags']:
+ self.soledad.delete_doc.assert_any_call(doc)
+ self.assertEqual(3, len(self.soledad.delete_doc.mock_calls))
- def _create_docs_of_type(self, type_list):
- return [self._create_doc_type(t) for t in type_list]
+ def _create_docs_of_type(self, type_list):
+ return [self._create_doc_type(t) for t in type_list]
- def _create_doc_type(self, doc_type):
- doc = MagicMock(spec=SoledadDocument)
- doc.content = {'type': doc_type}
- return doc
+ def _create_doc_type(self, doc_type):
+ doc = MagicMock(spec=SoledadDocument)
+ doc.content = {'type': doc_type}
+ return doc
- def test_load_mails_empty_path_list(self):
- load_mails(self.args, [])
+ def test_load_mails_empty_path_list(self):
+ load_mails(self.args, [])
- self.assertFalse(self.mailbox.called)
+ self.assertFalse(self.mailbox.called)
- def test_load_mails_adds_mails(self):
- mail_root = join(dirname(__file__), '..', 'fixtures', 'mailset')
+ def test_load_mails_adds_mails(self):
+ mail_root = join(dirname(__file__), '..', 'fixtures', 'mailset')
- foo = load_mails(self.args, [mail_root])
+ foo = load_mails(self.args, [mail_root])
- self.assertTrue(self.mailbox.addMessage.called)
- self.mailbox.addMessage.assert_any_call(self._mail_content(join(mail_root, 'mbox00000000')), flags=("\\RECENT",), notify_on_disk=False)
- self.mailbox.addMessage.assert_any_call(self._mail_content(join(mail_root, 'mbox00000001')), flags=("\\RECENT",), notify_on_disk=False)
+ self.assertTrue(self.mailbox.addMessage.called)
+ self.mailbox.addMessage.assert_any_call(self._mail_content(join(mail_root, 'mbox00000000')), flags=("\\RECENT",), notify_on_disk=False)
+ self.mailbox.addMessage.assert_any_call(self._mail_content(join(mail_root, 'mbox00000001')), flags=("\\RECENT",), notify_on_disk=False)
- def _mail_content(self, mail_file):
- with open(mail_file, 'r') as fp:
- m = email.message_from_file(fp)
- return m.as_string()
+ def _mail_content(self, mail_file):
+ with open(mail_file, 'r') as fp:
+ m = email.message_from_file(fp)
+ return m.as_string()