Esempio n. 1
0
    def test_basic(self):
        """Check get/parse cycle"""
        dup_time.setprevtime(10)
        dup_time.setcurtime(20)

        file_naming.prepare_regex(force = True)
        filename = file_naming.get("inc", volume_number = 23)
        log.Info(u"Inc filename: " + filename)
        pr = file_naming.parse(filename)
        assert pr and pr.type == "inc", pr
        assert pr.start_time == 10
        assert pr.end_time == 20
        assert pr.volume_number == 23
        assert not pr.partial

        filename = file_naming.get("full-sig")
        log.Info(u"Full sig filename: " + filename)
        pr = file_naming.parse(filename)
        assert pr.type == "full-sig"
        assert pr.time == 20
        assert not pr.partial

        filename = file_naming.get("new-sig")
        pr = file_naming.parse(filename)
        assert pr.type == "new-sig"
        assert pr.start_time == 10
        assert pr.end_time == 20
        assert not pr.partial
Esempio n. 2
0
    def test_basic(self):
        """Check get/parse cycle"""
        dup_time.setprevtime(10)
        dup_time.setcurtime(20)

        filename = file_naming.get("inc", volume_number=23)
        log.Info("Inc filename: " + filename)
        pr = file_naming.parse(filename)
        assert pr and pr.type == "inc", pr
        assert pr.start_time == 10
        assert pr.end_time == 20
        assert pr.volume_number == 23
        assert not pr.partial

        filename = file_naming.get("full-sig")
        log.Info("Full sig filename: " + filename)
        pr = file_naming.parse(filename)
        assert pr.type == "full-sig"
        assert pr.time == 20
        assert not pr.partial

        filename = file_naming.get("new-sig")
        pr = file_naming.parse(filename)
        assert pr.type == "new-sig"
        assert pr.start_time == 10
        assert pr.end_time == 20
        assert not pr.partial
Esempio n. 3
0
    def test_basic(self):
        u"""Check get/parse cycle"""
        dup_time.setprevtime(10)
        dup_time.setcurtime(20)

        file_naming.prepare_regex(force=True)
        filename = file_naming.get(u"inc", volume_number=23)
        log.Info(u"Inc filename: " + util.fsdecode(filename))
        pr = file_naming.parse(filename)
        assert pr and pr.type == u"inc", pr
        assert pr.start_time == 10
        assert pr.end_time == 20
        assert pr.volume_number == 23
        assert not pr.partial

        filename = file_naming.get(u"full-sig")
        log.Info(u"Full sig filename: " + util.fsdecode(filename))
        pr = file_naming.parse(filename)
        assert pr.type == u"full-sig"
        assert pr.time == 20
        assert not pr.partial

        filename = file_naming.get(u"new-sig")
        pr = file_naming.parse(filename)
        assert pr.type == u"new-sig"
        assert pr.start_time == 10
        assert pr.end_time == 20
        assert not pr.partial
Esempio n. 4
0
    def test_suffix(self):
        """Test suffix (encrypt/compressed) encoding and generation"""
        filename = file_naming.get("inc", manifest=1, gzipped=1)
        pr = file_naming.parse(filename)
        assert pr and pr.compressed == 1
        assert pr.manifest

        filename2 = file_naming.get("full", volume_number=23, encrypted=1)
        pr = file_naming.parse(filename2)
        assert pr and pr.encrypted == 1
        assert pr.volume_number == 23
Esempio n. 5
0
    def test_suffix(self):
        """Test suffix (encrypt/compressed) encoding and generation"""
        filename = file_naming.get("inc", manifest = 1, gzipped = 1)
        pr = file_naming.parse(filename)
        assert pr and pr.compressed == 1
        assert pr.manifest

        filename2 = file_naming.get("full", volume_number = 23, encrypted = 1)
        pr = file_naming.parse(filename2)
        assert pr and pr.encrypted == 1
        assert pr.volume_number == 23
Esempio n. 6
0
    def try_fileobj_ops(self, backend):
        """Test above try_fileobj_filename with a few filenames"""
        # Must set dup_time strings because they are used by file_naming
        dup_time.setcurtime(2000)
        dup_time.setprevtime(1000)
        # Also set profile for encryption
        globals.gpg_profile = gpg.GPGProfile(passphrase = "foobar")

        filename1 = file_naming.get('full', manifest = 1, gzipped = 1)
        self.try_fileobj_filename(backend, filename1)

        filename2 = file_naming.get('new-sig', encrypted = 1)
        self.try_fileobj_filename(backend, filename2)
Esempio n. 7
0
    def try_fileobj_ops(self, backend):
        """Test above try_fileobj_filename with a few filenames"""
        # Must set dup_time strings because they are used by file_naming
        dup_time.setcurtime(2000)
        dup_time.setprevtime(1000)
        # Also set profile for encryption
        globals.gpg_profile = gpg.GPGProfile(passphrase = "foobar")

        filename1 = file_naming.get('full', manifest = 1, gzipped = 1)
        self.try_fileobj_filename(backend, filename1)

        filename2 = file_naming.get('new-sig', encrypted = 1)
        self.try_fileobj_filename(backend, filename2)