Пример #1
0
 def test_detect_exception(self):
     filepath = abspath(
         "./tests/testdata/archive_hash/test_sample4.txt")
     archive_path = abspath(
         "./tests/testdata/archive_hash")
     with pytest.raises(ValueError):
         diff.detect(filepath, archive_path, DIFF_HASH)
Пример #2
0
    def test_detect3(self):
        filepath = abspath(
            "./tests/testdata/archive_hash/test_sample3.txt")
        archive_path = abspath(
            "./tests/testdata/archive_hash")

        probe_diff = diff.detect(filepath, archive_path, DIFF_HASH,
                                 HASH_SHA256)

        assert probe_diff is None
Пример #3
0
    def test_detect4(self):
        filepath = abspath(
            "./tests/testdata/archive_hash/test_sample4.txt")
        archive_path = abspath(
            "./tests/testdata/archive_hash")
        expected_difftype = '+'
        expected_state = restore.get_file_hash(filepath, HASH_SHA256)

        probe_diff = diff.detect(filepath, archive_path, DIFF_HASH,
                                 HASH_SHA256)

        assert probe_diff.difftype == expected_difftype
        assert probe_diff.state == expected_state
Пример #4
0
    def test_detect2(self):
        filepath = abspath(
            "./tests/testdata/archive_hash/test_sample2.txt")
        archive_path = abspath(
            "./tests/testdata/archive_hash")
        expected_difftype = '-'
        expected_state = None

        probe_diff = diff.detect(filepath, archive_path, DIFF_HASH,
                                 HASH_SHA256)

        assert probe_diff.difftype == expected_difftype
        assert probe_diff.state == expected_state