def test_backup_and_restore(self): """ Backup from gmvault_test and restore """ gsync_credential = {'type': 'passwd', 'value': self.gsync_passwd} gmvault_test_credential = { 'type': 'passwd', 'value': self.gmvault_test_passwd } test_utils.clean_mailbox(self.gsync_login, gsync_credential) gmvault_test_db_dir = "/tmp/backup-restore" backuper = gmvault.GMVaulter(gmvault_test_db_dir, 'imap.gmail.com', 993, \ self.gmvault_test_login, gmvault_test_credential, \ read_only_access = False) backuper.sync({'mode': 'full', 'type': 'imap', 'req': 'ALL'}) #check that we have x emails in the database restorer = gmvault.GMVaulter(gmvault_test_db_dir, 'imap.gmail.com', 993, \ self.gsync_login, gsync_credential, \ read_only_access = False) restorer.restore() #restore all emails from this essential-db test_utils.check_remote_mailbox_identical_to_local(self, restorer) test_utils.diff_online_mailboxes(backuper, restorer) gmvault_utils.delete_all_under(gmvault_test_db_dir, delete_top_dir=True)
def test_backup_and_restore(self): """backup from gmvault_test and restore""" gsync_credential = { 'type' : 'passwd', 'value': self.gsync_passwd } gmvault_test_credential = { 'type' : 'passwd', 'value': self.gmvault_test_passwd } test_utils.clean_mailbox(self.gsync_login, gsync_credential) gmvault_test_db_dir = "/tmp/backup-restore" backuper = gmvault.GMVaulter(gmvault_test_db_dir, 'imap.gmail.com', 993, \ self.gmvault_test_login, gmvault_test_credential, \ read_only_access = False) backuper.sync({ 'mode': 'full', 'type': 'imap', 'req': 'ALL' }) #check that we have x emails in the database restorer = gmvault.GMVaulter(gmvault_test_db_dir, 'imap.gmail.com', 993, \ self.gsync_login, gsync_credential, \ read_only_access = False) restorer.restore() #restore all emails from this essential-db test_utils.check_remote_mailbox_identical_to_local(self, restorer) test_utils.diff_online_mailboxes(backuper, restorer) gmvault_utils.delete_all_under(gmvault_test_db_dir, delete_top_dir = True)
def ztest_delete_gsync(self): """ Simply delete gsync """ gsync_credential = { 'type' : 'passwd', 'value': self.gsync_passwd } gmvault_test_credential = { 'type' : 'passwd', 'value': self.gmvault_test_passwd } test_utils.clean_mailbox(self.gsync_login, gsync_credential)
def ztest_delete_gsync(self): """ Simply delete gsync """ gsync_credential = {'type': 'passwd', 'value': self.gsync_passwd} gmvault_test_credential = { 'type': 'passwd', 'value': self.gmvault_test_passwd } test_utils.clean_mailbox(self.gsync_login, gsync_credential)
def ztest_restore_tricky_emails(self): """test_restore_tricky_emails. Restore emails with some specificities (japanese characters) in the a mailbox""" gsync_credential = { 'type' : 'passwd', 'value': self.gsync_passwd } test_utils.clean_mailbox(self.gsync_login, gsync_credential) # test restore test_db_dir = "/homespace/gaubert/gmvault-dbs/essential-dbs" #test_db_dir = "/home/gmv/Dev/projects/gmvault-develop/src/test-db" #test_db_dir = "/Users/gaubert/Dev/projects/gmvault-develop/src/test-db" restorer = gmvault.GMVaulter(test_db_dir, 'imap.gmail.com', 993, \ self.gsync_login, gsync_credential, \ read_only_access = False) restorer.restore() #restore all emails from this essential-db test_utils.check_remote_mailbox_identical_to_local(self, restorer)
def test_restore_tricky_emails(self): """ Test_restore_tricky_emails. Restore emails with some specificities (japanese characters) in the a mailbox """ gsync_credential = {'type': 'passwd', 'value': self.gsync_passwd} extra_labels = [u"My-Extra-Label"] test_utils.clean_mailbox(self.gsync_login, gsync_credential) # test restore test_db_dir = "/homespace/gaubert/gmvault-dbs/essential-dbs" #test_db_dir = "/home/gmv/Dev/projects/gmvault-develop/src/test-db" #test_db_dir = "/Users/gaubert/Dev/projects/gmvault-develop/src/test-db" restorer = gmvault.GMVaulter(test_db_dir, 'imap.gmail.com', 993, \ self.gsync_login, gsync_credential, \ read_only_access = False) restorer.restore(extra_labels=extra_labels ) #restore all emails from this essential-db test_utils.check_remote_mailbox_identical_to_local( self, restorer, extra_labels)