2
# -*- Mode: Python; indent-tabs-mode: nil; tab-width: 2; coding: utf-8 -*-
4
# This file is part of Déjà Dup.
5
# For copyright information, see AUTHORS.
7
# Déjà Dup is free software; you can redistribute it and/or modify
8
# it under the terms of the GNU General Public License as published by
9
# the Free Software Foundation; either version 3 of the License, or
10
# (at your option) any later version.
12
# Déjà Dup is distributed in the hope that it will be useful, but
13
# WITHOUT ANY WARRANTY; without even the implied warranty of
14
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15
# General Public License for more details.
17
# You should have received a copy of the GNU General Public License
18
# along with Déjà Dup. If not, see <http://www.gnu.org/licenses/>.
20
# Test whether we correctly ask or not for the encryption password
24
sys.path.insert(0, scriptdir+'/..')
30
def wait_for_volume(destdir, basenum):
32
while len(os.listdir(destdir)) < basenum+2 and count < 200:
38
os.environ['PATH'] = os.path.join(scriptdir, 'encrypt-bin') + ":" + os.environ['PATH']
39
base.backup_simple(backend='file', encrypt=True, includes=['data/simple'])
40
basenum = len(os.listdir(base.get_temp_name('local')))
41
base.backup_simple(encrypt=True, finish=False, includes=['/usr/bin'])
42
# Test resuming a backup too
43
wait_for_volume(base.get_temp_name('local'), basenum)
44
ldtp.click('frmBackUp', 'btnResumeLater')
45
base.backup_simple(encrypt=True)
46
base.restore_simple(base.get_temp_name('restore'), encrypt=True)
48
def encrypt_nocache():
50
base.backup_simple(backend='file', encrypt=True, includes=['data/simple'])
51
os.system('rm -r %s' % base.get_temp_name('cache/deja-dup'))
52
basenum = len(os.listdir(base.get_temp_name('local')))
53
base.backup_simple(encrypt=True, finish=False, includes=['/usr/bin'])
54
# Test resuming a backup too
55
wait_for_volume(base.get_temp_name('local'), basenum)
56
ldtp.click('frmBackUp', 'btnResumeLater')
57
base.backup_simple(encrypt=True)
58
os.system('rm -r %s' % base.get_temp_name('cache/deja-dup'))
59
base.restore_simple(base.get_temp_name('restore'), encrypt=True)
63
base.backup_simple(backend='file', encrypt=False, includes=['data/simple'])
64
basenum = len(os.listdir(base.get_temp_name('local')))
65
base.backup_simple(encrypt=None, finish=False, includes=['/usr/bin'])
66
# Test resuming a backup too
67
wait_for_volume(base.get_temp_name('local'), basenum)
68
ldtp.click('frmBackUp', 'btnResumeLater')
69
base.backup_simple(encrypt=None)
70
base.restore_simple(base.get_temp_name('restore'), encrypt=None)
72
def noencrypt_nocache():
74
base.backup_simple(backend='file', encrypt=False, includes=['data/simple'])
75
os.system('rm -r %s' % base.get_temp_name('cache/deja-dup'))
76
basenum = len(os.listdir(base.get_temp_name('local')))
77
base.backup_simple(encrypt=None, finish=False, includes=['/usr/bin'])
78
# Test resuming a backup too
79
wait_for_volume(base.get_temp_name('local'), basenum)
80
ldtp.click('frmBackUp', 'btnResumeLater')
81
base.backup_simple(encrypt=None)
82
os.system('rm -r %s' % base.get_temp_name('cache/deja-dup'))
83
base.restore_simple(base.get_temp_name('restore'), encrypt=None)
86
base.run(encrypt_nocache)
88
base.run(noencrypt_nocache)