~duplicity-team/duplicity/0.7-series

« back to all changes in this revision

Viewing changes to testing/unit/test_collections.py

  • Committer: Kenneth Loafman
  • Date: 2014-12-12 14:39:54 UTC
  • Revision ID: kenneth@loafman.com-20141212143954-wyln65yd1ynzsrlx
* Source formatted, using PyDev, all source files to fix some easily fixed
  PEP8 issues. Use ignore space when comparing against previous versions.

Show diffs side-by-side

added added

removed removed

Lines of Context:
44
44
                                 "duplicity-new-signatures.2002-08-17T16:17:01-07:00.to.2002-08-18T00:04:30-07:00.sigtar.gpg",
45
45
                                 "duplicity-new-signatures.2002-08-18T00:04:30-07:00.to.2002-08-20T00:00:00-07:00.sigtar.gpg"]
46
46
 
47
 
local_sigchain_filename_list =  ["duplicity-full-signatures.2002-08-17T16:17:01-07:00.sigtar.gz",
 
47
local_sigchain_filename_list = ["duplicity-full-signatures.2002-08-17T16:17:01-07:00.sigtar.gz",
48
48
                                 "duplicity-new-signatures.2002-08-17T16:17:01-07:00.to.2002-08-18T00:04:30-07:00.sigtar.gz",
49
49
                                 "duplicity-new-signatures.2002-08-18T00:04:30-07:00.to.2002-08-20T00:00:00-07:00.sigtar.gz"]
50
50
 
82
82
        self.archive_dir_backend = backend.get_backend("file://testfiles/collectionstest"
83
83
                                                       "/archive_dir")
84
84
 
85
 
        self.real_backend = backend.get_backend("file://%s/%s" %
 
85
        self.real_backend = backend.get_backend("file://%s/%s" % 
86
86
                                                (col_test_dir.name, "remote_dir"))
87
 
        self.output_dir = path.Path("testfiles/output") # used as a temp directory
 
87
        self.output_dir = path.Path("testfiles/output")  # used as a temp directory
88
88
        self.output_dir_backend = backend.get_backend("file://testfiles/output")
89
89
 
90
90
    def set_gpg_profile(self):
91
91
        """Set gpg profile to standard "foobar" sym"""
92
 
        self.set_global('gpg_profile', gpg.GPGProfile(passphrase = "foobar"))
 
92
        self.set_global('gpg_profile', gpg.GPGProfile(passphrase="foobar"))
93
93
 
94
94
    def test_backup_chains(self):
95
95
        """Test basic backup chain construction"""
96
96
        random.shuffle(filename_list1)
97
97
        cs = collections.CollectionsStatus(None, globals.archive_dir)
98
 
        chains, orphaned, incomplete = cs.get_backup_chains(filename_list1) #@UnusedVariable
 
98
        chains, orphaned, incomplete = cs.get_backup_chains(filename_list1)  # @UnusedVariable
99
99
        if len(chains) != 1 or len(orphaned) != 0:
100
100
            print chains
101
101
            print orphaned
129
129
    def test_sig_chains(self):
130
130
        """Test making signature chains from filename list"""
131
131
        cs = collections.CollectionsStatus(None, globals.archive_dir)
132
 
        chains, orphaned_paths = cs.get_signature_chains(local = 1)
 
132
        chains, orphaned_paths = cs.get_signature_chains(local=1)
133
133
        self.sig_chains_helper(chains, orphaned_paths)
134
134
 
135
135
    def test_sig_chains2(self):
136
136
        """Test making signature chains from filename list on backend"""
137
137
        cs = collections.CollectionsStatus(self.archive_dir_backend, globals.archive_dir)
138
 
        chains, orphaned_paths = cs.get_signature_chains(local = None)
 
138
        chains, orphaned_paths = cs.get_signature_chains(local=None)
139
139
        self.sig_chains_helper(chains, orphaned_paths)
140
140
 
141
141
    def sig_chains_helper(self, chains, orphaned_paths):
204
204
                      "duplicity-full.2002-08-15T01:01:01-07:00.vol1.difftar.gpg",
205
205
                      "duplicity-inc.2000-08-17T16:17:01-07:00.to.2000-08-18T00:04:30-07:00.manifest.gpg",
206
206
                      "duplicity-inc.2000-08-17T16:17:01-07:00.to.2000-08-18T00:04:30-07:00.vol1.difftar.gpg"]
207
 
        local_received_list, remote_received_list = cs.get_extraneous(False) #@UnusedVariable
 
207
        local_received_list, remote_received_list = cs.get_extraneous(False)  # @UnusedVariable
208
208
        errors = []
209
209
        for filename in remote_received_list:
210
210
            if filename not in right_list:
212
212
            else: right_list.remove(filename)
213
213
        for filename in right_list:
214
214
            errors.append("### Didn't receive extraneous filename " + filename)
215
 
        assert not errors, "\n"+"\n".join(errors)
 
215
        assert not errors, "\n" + "\n".join(errors)
216
216
 
217
217
    def test_get_olderthan(self):
218
218
        """Test getting list of files older than a certain time"""