Exemple #1
0
    def test_valid_by_md5_file(self):
        create_file(self.file)
        md5_file = join(self.tmp, "my.md5")
        safe_write(EMPTY_FILE_MD5, md5_file, append=False)

        validate_file(self.file, md5_file)
Exemple #2
0
    def test_valid_by_md5(self):
        create_file(self.file)

        validate_file(self.file, EMPTY_FILE_MD5)
Exemple #3
0
    def test_valid_if_exists(self):
        create_file(self.file)

        validate_file(self.file)
Exemple #4
0
    def test_invalid_if_md5_mismatch(self):
        create_file(self.file)

        with assert_raises(ValueError):
            validate_file(self.file, ":wrong-md5:")
Exemple #5
0
 def test_invalid_if_not_exists(self):
     with assert_raises(FileNotFoundError):
         validate_file(self.file)