Exemple #1
0
    def test_sort_sids(self):
        root = snapshots.RootSnapshot(self.cfg)
        new = snapshots.NewSnapshot(self.cfg)
        sid1 = snapshots.SID('20151219-010324-123', self.cfg)
        sid2 = snapshots.SID('20151219-020324-123', self.cfg)
        sid3 = snapshots.SID('20151219-030324-123', self.cfg)
        sid4 = snapshots.SID('20151219-040324-123', self.cfg)

        sids1 = [sid3, sid1, sid4, sid2]
        sids1.sort()
        self.assertEqual(sids1, [sid1, sid2, sid3, sid4])

        #RootSnapshot 'Now' should always stay on top
        sids2 = [sid3, sid1, root, sid4, sid2]
        sids2.sort()
        self.assertEqual(sids2, [sid1, sid2, sid3, sid4, root])

        sids2.sort(reverse=True)
        self.assertEqual(sids2, [root, sid4, sid3, sid2, sid1])

        #new_snapshot should always be the last
        sids3 = [sid3, sid1, new, sid4, sid2]
        sids3.sort()
        self.assertEqual(sids3, [sid1, sid2, sid3, sid4, new])

        sids3.sort(reverse=True)
        self.assertEqual(sids3, [new, sid4, sid3, sid2, sid1])
Exemple #2
0
 def test_create(self):
     sid = snapshots.RootSnapshot(self.cfg)
     self.assertTrue(sid.isRoot)
     self.assertEqual(sid.sid, '/')
     self.assertEqual(sid.name, 'Now')
Exemple #3
0
 def test_path(self):
     sid = snapshots.RootSnapshot(self.cfg)
     self.assertEqual(sid.path(), '/')
     self.assertEqual(sid.path('foo', 'bar'), '/foo/bar')
Exemple #4
0
with TemporaryDirectory() as tmp:
    cfgFile = os.path.join(tmp, 'config')
    appInstanceFile = os.path.join(tmp, 'appinstance')
    cfg = config.Config(cfgFile)
    appInstance = GUIApplicationInstance(appInstanceFile, '')

    cfg.setSnapshotsPath(tmp)
    cfg.setInclude([
        ('/home/janedoe', 0),
    ])
    cfg.checkConfig()
    cfg.save()

    sn = snapshots.Snapshots(cfg)
    rootSid = snapshots.RootSnapshot(cfg)

    global qapp
    qapp = qttools.createQApplication(cfg.APP_NAME)
    translator = qttools.translator()
    qapp.installTranslator(translator)

    #########################
    ### Snapshot Log View ###
    #########################

    cmd = ['../backintime/common/backintime', '--config', cfgFile, 'backup']
    proc = subprocess.Popen(cmd)
    proc.communicate()

    mainWindow = app.MainWindow(cfg, appInstance, qapp)