def test_overwrite_file_content(self): testfile = "%s%s%s" % (TestFileHelper.testdatadir, os.path.sep, "testfilename") size = 2000 FileHelper.create_file(testfile, overwrite=True, size=size, content="aaa") sha1 = FileHelper.sha256(testfile) FileHelper.overwrite_file_content(testfile,10,100,"@@@") sha2 = FileHelper.sha256(testfile) self.assertNotEqual(sha1, sha2)
def test_overwrite_file_content(self): testfile = "%s%s%s" % (TestFileHelper.testdatadir, os.path.sep, "test_overwrite.dat") size = 2000 size_overwrite = 50 FileHelper.create_file(testfile, overwrite=True, size=size, content="aaa") sha1 = FileHelper.sha256(testfile) FileHelper.overwrite_file_content(testfile, size/2, size_overwrite, "%%%%") sha2 = FileHelper.sha256(testfile) new_size = FileHelper.get_file_size(testfile) self.assertEqual(new_size, size) self.assertNotEqual(sha1, sha2)