コード例 #1
0
    def test_06_createfolders(self):
        """Test if createfolders works as expected

        Create a local Maildir, then sync with remote "createfolders"
        disabled. Delete local Maildir and sync. We should have no new
        local maildir then. TODO: Rewrite this test to directly test
        and count the remote folders when the helper functions have
        been written"""
        config = OLITestLib.get_default_config()
        config.set('Repository IMAP', 'createfolders',
                   'False' )
        OLITestLib.write_config_file(config)

        # delete all remote and local testfolders
        OLITestLib.delete_remote_testfolders()
        OLITestLib.delete_maildir('')
        OLITestLib.create_maildir('INBOX.OLItest')
        code, res = OLITestLib.run_OLI()
        #logging.warn("%s %s "% (code, res))
        self.assertEqual(res, "")
        OLITestLib.delete_maildir('INBOX.OLItest')
        code, res = OLITestLib.run_OLI()
        self.assertEqual(res, "")
        boxes, mails = OLITestLib.count_maildir_mails('')
        self.assertTrue((boxes, mails)==(0,0), msg="Expected 0 folders and 0 "
            "mails, but sync led to {} folders and {} mails".format(
                boxes, mails))
コード例 #2
0
    def test_05_createmail(self):
        """Create mail in OLItest 1, sync, wipe folder sync

        Currently, this will mean the folder will be recreated
        locally.  At some point when remote folder deletion is
        implemented, this behavior will change."""
        OLITestLib.delete_remote_testfolders()
        OLITestLib.delete_maildir('')  # Delete all local maildir folders
        OLITestLib.create_maildir('INBOX.OLItest')
        OLITestLib.create_mail('INBOX.OLItest')
        code, res = OLITestLib.run_OLI()
        # logging.warn("%s %s "% (code, res))
        self.assertEqual(res, "")
        boxes, mails = OLITestLib.count_maildir_mails('')
        self.assertTrue(
            (boxes, mails) == (1, 1),
            msg="Expected 1 folders and 1 "
            "mails, but sync led to {0} folders and {1} mails".format(
                boxes, mails))
        # The local Mail should have been assigned a proper UID now, check!
        uids = OLITestLib.get_maildir_uids('INBOX.OLItest')
        self.assertFalse(
            None in uids,
            msg="All mails should have been "
            "assigned the IMAP's UID number, but {0} messages had no valid ID "
            .format(len([None for x in uids if x is None])))
コード例 #3
0
    def test_01_olistartup(self):
        """Tests if OLI can be invoked without exceptions

        Cleans existing remote tet folders. Then syncs all "OLItest*
        (specified in the default config) to our local Maildir. The
        result should be 0 folders and 0 mails."""
        OLITestLib.delete_remote_testfolders()
        code, res = OLITestLib.run_OLI()
        self.assertEqual(res, "")
        boxes, mails = OLITestLib.count_maildir_mails('')
        self.assertTrue((boxes, mails)==(0,0), msg="Expected 0 folders and 0 "
            "mails, but sync led to {0} folders and {1} mails".format(
                boxes, mails))
コード例 #4
0
    def test_01_olistartup(self):
        """Tests if OLI can be invoked without exceptions

        Cleans existing remote tet folders. Then syncs all "OLItest*
        (specified in the default config) to our local Maildir. The
        result should be 0 folders and 0 mails."""
        OLITestLib.delete_remote_testfolders()
        code, res = OLITestLib.run_OLI()
        self.assertEqual(res, "")
        boxes, mails = OLITestLib.count_maildir_mails('')
        self.assertTrue(
            (boxes, mails) == (0, 0),
            msg="Expected 0 folders and 0 "
            "mails, but sync led to {} folders and {} mails".format(
                boxes, mails))
コード例 #5
0
    def test_05_createmail(self):
        """Create mail in OLItest 1, sync, wipe folder sync

        Currently, this will mean the folder will be recreated
        locally.  At some point when remote folder deletion is
        implemented, this behavior will change."""
        OLITestLib.delete_remote_testfolders()
        OLITestLib.delete_maildir('') #Delete all local maildir folders
        OLITestLib.create_maildir('INBOX.OLItest')
        OLITestLib.create_mail('INBOX.OLItest')
        code, res = OLITestLib.run_OLI()
        #logging.warn("%s %s "% (code, res))
        self.assertEqual(res, "")
        boxes, mails = OLITestLib.count_maildir_mails('')
        self.assertTrue((boxes, mails)==(1,1), msg="Expected 1 folders and 1 "
            "mails, but sync led to {0} folders and {1} mails".format(
                boxes, mails))
        # The local Mail should have been assigned a proper UID now, check!
        uids = OLITestLib.get_maildir_uids('INBOX.OLItest')
        self.assertFalse (None in uids, msg = "All mails should have been "+ \
            "assigned the IMAP's UID number, but {0} messages had no valid ID "\
            .format(len([None for x in uids if x==None])))
コード例 #6
0
 def tearDown(self):
     OLITestLib.delete_remote_testfolders()
コード例 #7
0
 def setUp(self):
     OLITestLib.delete_remote_testfolders()