mirror of
https://github.com/theupdateframework/python-tuf
synced 2026-05-24 10:08:28 +00:00
Merge pull request #716 from vladimir-v-diaz/replace_os.stat.st_ino
Replace `os.stat(...).st_ino` calls made in unit test
This commit is contained in:
commit
908919d4e9
1 changed files with 13 additions and 2 deletions
|
|
@ -780,8 +780,14 @@ def test_write_metadata_file(self):
|
|||
first_version_output_file = os.path.join(temporary_directory, version_and_filename)
|
||||
self.assertTrue(os.path.exists(first_version_output_file))
|
||||
|
||||
# Verify that the consistent file content is equal to 'output_filename'.
|
||||
self.assertEqual(
|
||||
securesystemslib.util.get_file_details(output_filename),
|
||||
securesystemslib.util.get_file_details(first_version_output_file))
|
||||
|
||||
# Try to add more consistent metadata files.
|
||||
version_number += 1
|
||||
root_signable['signed']['version'] = version_number
|
||||
repo_lib.write_metadata_file(root_signable, output_filename,
|
||||
version_number, consistent_snapshot=True)
|
||||
|
||||
|
|
@ -790,8 +796,13 @@ def test_write_metadata_file(self):
|
|||
version_and_filename = str(version_number) + '.' + 'root.json'
|
||||
second_version_output_file = os.path.join(temporary_directory, version_and_filename)
|
||||
self.assertTrue(os.path.exists(second_version_output_file))
|
||||
self.assertNotEqual(os.stat(output_filename).st_ino, os.stat(first_version_output_file).st_ino)
|
||||
self.assertEqual(os.stat(output_filename).st_ino, os.stat(second_version_output_file).st_ino)
|
||||
|
||||
# Verify that the second version is equal to the second output file, and
|
||||
# that the second output filename differs from the first.
|
||||
self.assertEqual(securesystemslib.util.get_file_details(output_filename),
|
||||
securesystemslib.util.get_file_details(second_version_output_file))
|
||||
self.assertNotEqual(securesystemslib.util.get_file_details(output_filename),
|
||||
securesystemslib.util.get_file_details(first_version_output_file))
|
||||
|
||||
# Test for an improper settings.CONSISTENT_METHOD string value.
|
||||
tuf.settings.CONSISTENT_METHOD = 'somebadidea'
|
||||
|
|
|
|||
Loading…
Reference in a new issue