~antmak/duplicity/0.7-par2-fix

« back to all changes in this revision

Viewing changes to testing/manual/config.py.tmpl

  • Committer: Michael Terry
  • Date: 2014-04-28 02:49:39 UTC
  • mto: This revision was merged to the branch mainline in revision 981.
  • Revision ID: michael.terry@canonical.com-20140428024939-p2fbckcm35uh0ogs
further fixes

Show diffs side-by-side

added added

removed removed

Lines of Context:
19
19
# along with duplicity; if not, write to the Free Software Foundation,
20
20
# Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
21
21
 
22
 
import sys, os
23
 
testing = os.path.dirname(sys.argv[0])
24
 
newpath = os.path.abspath(os.path.join(testing, "../../."))
25
 
sys.path.insert(0, newpath)
26
 
 
27
 
import gettext
28
 
gettext.install('duplicity', codeset='utf8')
29
 
 
30
 
from duplicity import globals
31
 
from duplicity import log
32
 
from duplicity import backend
33
 
from duplicity.backends import localbackend
34
 
 
35
 
# config for duplicity unit tests
36
 
 
37
 
# verbosity, default is log.WARNING
38
 
verbosity = log.WARNING
39
 
 
40
 
# to test GPG and friends
41
 
# these must be without passwords
42
 
encrypt_key1 = ""
43
 
encrypt_key2 = ""
44
 
 
45
 
# password required on this one
46
 
sign_key = ""
47
 
sign_passphrase = ""
48
 
 
49
22
# URLs for testing
50
 
# NOTE: if the ***_url is None or "" the test
51
 
# is skipped and is noted in the test results.
52
 
 
53
 
file_url = "file:///tmp/testdup"
54
 
file_password = None
55
 
 
56
 
# To set up rsyncd for test:
57
 
# /etc/rsyncd.conf contains
58
 
# [testdup]
59
 
# path = /tmp/testdup
60
 
# comment = Test area for duplicity
61
 
# read only = false
62
 
#
63
 
# NOTE: chmod 777 /tmp/testdup
 
23
# NOTE: if the ***_url is None, the test is skipped
64
24
 
65
25
ftp_url = None
66
26
ftp_password = None
81
41
s3_access_key = None
82
42
s3_secret_key = None
83
43
 
 
44
cf_url = None
 
45
cf_username = None
 
46
cf_api_key = None
 
47
 
 
48
swift_url = None
 
49
swift_tenant = None
 
50
swift_username = None
 
51
swift_password = None
 
52
 
 
53
dpbx_url = None
 
54
 
 
55
imap_url = None
 
56
imap_password = None
 
57
 
 
58
mega_url = None
 
59
mega_password = None
 
60
 
84
61
webdav_url = None
85
62
webdav_password = None
86
63
 
89
66
 
90
67
gdocs_url = None
91
68
gdocs_password = None
92
 
 
93
 
def setup():
94
 
    """ setup for unit tests """
95
 
    # The following is for starting remote debugging in Eclipse with Pydev.
96
 
    # Adjust the path to your location and version of Eclipse and Pydev.  Comment out
97
 
    # to run normally, or this process will hang at pydevd.settrace() waiting for the
98
 
    # remote debugger to start.
99
 
#    pysrc = "/opt/Aptana Studio 2/plugins/org.python.pydev.debug_2.1.0.2011052613/pysrc/"
100
 
#    sys.path.append(pysrc)
101
 
#    import pydevd #@UnresolvedImport
102
 
#    pydevd.settrace()
103
 
    # end remote debugger startup
104
 
 
105
 
    log.setup()
106
 
    log.setverbosity(verbosity)
107
 
    globals.print_statistics = 0
108
 
 
109
 
    globals.num_retries = 2
110
 
 
111
 
    backend.import_backends()
112
 
 
113
 
    set_environ("FTP_PASSWORD", None)
114
 
    set_environ("PASSPHRASE", None)
115
 
    if gs_access_key:
116
 
        set_environ("GS_ACCESS_KEY_ID", gs_access_key)
117
 
        set_environ("GS_SECRET_ACCESS_KEY", gs_secret_key)
118
 
    else:
119
 
        set_environ("GS_ACCESS_KEY_ID", None)
120
 
        set_environ("GS_SECRET_ACCESS_KEY", None)
121
 
    if s3_access_key:
122
 
        set_environ("AWS_ACCESS_KEY_ID", s3_access_key)
123
 
        set_environ("AWS_SECRET_ACCESS_KEY", s3_secret_key)
124
 
    else:
125
 
        set_environ("AWS_ACCESS_KEY_ID", None)
126
 
        set_environ("AWS_SECRET_ACCESS_KEY", None)
127
 
 
128
 
 
129
 
def set_environ(varname, value):
130
 
    if value is not None:
131
 
        os.environ[varname] = value
132
 
    else:
133
 
        try:
134
 
            del os.environ[varname]
135
 
        except Exception:
136
 
            pass