~ubuntu-branches/ubuntu/saucy/deja-dup/saucy

« back to all changes in this revision

Viewing changes to tests/backup/encrypt

  • Committer: Package Import Robot
  • Author(s): Michael Terry
  • Date: 2012-10-30 19:03:03 UTC
  • mfrom: (1.2.2)
  • Revision ID: package-import@ubuntu.com-20121030190303-w3fatge63ncm5uiw
Tags: 25.1.1-0ubuntu1
* New upstream release
* debian/control:
  - Use libsecret, not libgnome-keyring
  - Switch to valac-0.18
  - Add various deja-dup-backend-* metapackages to make seeding
    different ones easier for flavors
* debian/tests:
  - Add dep8 test to run upstream test suite against system install
* debian/patches/support-new-u1backend.patch:
  - Support new u1backend in duplicity 0.6.20

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
#!/usr/bin/env python
2
 
# -*- Mode: Python; indent-tabs-mode: nil; tab-width: 2; coding: utf-8 -*-
3
 
#
4
 
# This file is part of Déjà Dup.
5
 
# For copyright information, see AUTHORS.
6
 
#
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.
11
 
#
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.
16
 
#
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/>.
19
 
 
20
 
# Test whether we correctly ask or not for the encryption password
21
 
 
22
 
import sys
23
 
scriptdir=sys.path[0]
24
 
sys.path.insert(0, scriptdir+'/..')
25
 
import base
26
 
import os
27
 
import ldtp
28
 
import time
29
 
 
30
 
def wait_for_volume(destdir, basenum):
31
 
  count = 0
32
 
  while len(os.listdir(destdir)) < basenum+2 and count < 200:
33
 
    time.sleep(1)
34
 
    count += 1
35
 
 
36
 
def encrypt():
37
 
  base.setup()
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)
47
 
 
48
 
def encrypt_nocache():
49
 
  base.setup()
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)
60
 
 
61
 
def noencrypt():
62
 
  base.setup()
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)
71
 
 
72
 
def noencrypt_nocache():
73
 
  base.setup()
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)
84
 
 
85
 
base.run(encrypt)
86
 
base.run(encrypt_nocache)
87
 
base.run(noencrypt)
88
 
base.run(noencrypt_nocache)