@@ -0,0 +1,2727 @@
+# Copyright (C) 2012- Sebastian Spaeth & contributors%0A#%0A#    This program is free software; you can redistribute it and/or modify%0A#    it under the terms of the GNU General Public License as published by%0A#    the Free Software Foundation; either version 2 of the License, or%0A#    (at your option) any later version.%0A#%0A#    This program is distributed in the hope that it will be useful,%0A#    but WITHOUT ANY WARRANTY; without even the implied warranty of%0A#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the%0A#    GNU General Public License for more details.%0A#%0A#    You should have received a copy of the GNU General Public License%0A#    along with this program; if not, write to the Free Software%0A#    Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301 USA%0Aimport random%0Aimport unittest%0Aimport logging%0Aimport os, sys%0Afrom test.OLItest import OLITestLib%0A%0A# Things need to be setup first, usually setup.py initializes everything.%0A# but if e.g. called from command line, we take care of default values here:%0Aif not OLITestLib.cred_file:%0A    OLITestLib(cred_file='./test/credentials.conf', cmd='./offlineimap.py')%0A%0A%0Adef setUpModule():%0A    logging.info(%22Set Up test module %25s%22 %25 __name__)%0A    tdir = OLITestLib.create_test_dir(suffix=__name__)%0A%0Adef tearDownModule():%0A    logging.info(%22Tear Down test module%22)%0A    OLITestLib.delete_test_dir()%0A%0A#Stuff that can be used%0A#self.assertEqual(self.seq, range(10))%0A# should raise an exception for an immutable sequence%0A#self.assertRaises(TypeError, random.shuffle, (1,2,3))%0A#self.assertTrue(element in self.seq)%0A#self.assertFalse(element in self.seq)%0A%0Aclass TestBasicFunctions(unittest.TestCase):%0A    #@classmethod%0A    #def setUpClass(cls):%0A    #This is run before all tests in this class%0A    #    cls._connection = createExpensiveConnectionObject()%0A%0A    #@classmethod%0A    #This is run after all tests in this class%0A    #def tearDownClass(cls):%0A    #    cls._connection.destroy()%0A%0A    # This will be run before each test%0A    #def setUp(self):%0A    #    self.seq = range(10)%0A%0A    def test_01_MappedImap(self):%0A        %22%22%22Tests if a MappedIMAP sync can be invoked without exceptions%0A%0A        Cleans existing remote test folders. Then syncs all %22OLItest*%0A        (specified in the default config) to our local IMAP (Gmail). The%0A        result should be 0 folders and 0 mails.%22%22%22%0A        pass #TODO%0A        #OLITestLib.delete_remote_testfolders()%0A        #code, res = OLITestLib.run_OLI()%0A        #self.assertEqual(res, %22%22)%0A        #boxes, mails = OLITestLib.count_maildir_mails('')%0A        #self.assertTrue((boxes, mails)==(0,0), msg=%22Expected 0 folders and 0%22%0A        #    %22mails, but sync led to %7B%7D folders and %7B%7D mails%22.format(%0A        #        boxes, mails))%0A

Add MappedIMAP test skeleton