@@ -444,33 +444,33 @@ def test_build_merkle_tree(self):
444444 test_nodes = {}
445445 test_nodes ['file1' ] = tuf .formats .make_metadata_fileinfo (5 , None , None )
446446
447- root_1 , leaves = repo_lib .build_merkle_tree (test_nodes )
448- repo_lib .write_merkle_paths (root_1 , leaves , storage_backend ,
447+ root_1 , leaves = repo_lib ._build_merkle_tree (test_nodes )
448+ repo_lib ._write_merkle_paths (root_1 , leaves , storage_backend ,
449449 temporary_directory )
450450
451451 file_path = os .path .join (temporary_directory , 'file1-snapshot.json' )
452452 self .assertTrue (os .path .exists (file_path ))
453453
454454 test_nodes ['file2' ] = tuf .formats .make_metadata_fileinfo (5 , None , None )
455- root_2 , leaves = repo_lib .build_merkle_tree (test_nodes )
455+ root_2 , leaves = repo_lib ._build_merkle_tree (test_nodes )
456456
457- self .assertEqual (root_2 .left (). hash () , root_1 .hash () )
457+ self .assertEqual (root_2 .left . digest , root_1 .digest )
458458
459459 test_nodes ['file3' ] = tuf .formats .make_metadata_fileinfo (5 , None , None )
460460 test_nodes ['file4' ] = tuf .formats .make_metadata_fileinfo (5 , None , None )
461461
462- root_3 , leaves = repo_lib .build_merkle_tree (test_nodes )
462+ root_3 , leaves = repo_lib ._build_merkle_tree (test_nodes )
463463
464- self .assertEqual (root_3 .left (). hash () , root_2 .hash () )
464+ self .assertEqual (root_3 .left . digest , root_2 .digest )
465465
466466 test_nodes ['file5' ] = tuf .formats .make_metadata_fileinfo (5 , None , None )
467467
468- root_4 , leaves = repo_lib .build_merkle_tree (test_nodes )
468+ root_4 , leaves = repo_lib ._build_merkle_tree (test_nodes )
469469
470- repo_lib .write_merkle_paths (root_4 , leaves , storage_backend ,
470+ repo_lib ._write_merkle_paths (root_4 , leaves , storage_backend ,
471471 temporary_directory )
472472
473- self .assertEqual (root_4 .left (). hash () , root_3 .hash () )
473+ self .assertEqual (root_4 .left . digest , root_3 .digest )
474474
475475 # Ensure that the paths are written to the directory
476476 file_path = os .path .join (temporary_directory , 'file1-snapshot.json' )
@@ -484,7 +484,7 @@ def test_build_merkle_tree(self):
484484 test_nodes ['role1' ] = tuf .formats .make_metadata_fileinfo (1 , None , None )
485485 test_nodes ['role2' ] = tuf .formats .make_metadata_fileinfo (1 , None , None )
486486
487- root , leaves = repo_lib .build_merkle_tree (test_nodes )
487+ root , leaves = repo_lib ._build_merkle_tree (test_nodes )
488488
489489
490490
@@ -534,7 +534,7 @@ def test_generate_snapshot_metadata(self):
534534 repo_lib .generate_snapshot_metadata (metadata_directory , version ,
535535 expiration_date ,
536536 storage_backend ,
537- consistent_snapshot = False )
537+ consistent_snapshot = False )[ 0 ]
538538 self .assertTrue (tuf .formats .SNAPSHOT_SCHEMA .matches (snapshot_metadata ))
539539
540540
@@ -563,7 +563,7 @@ def test_generate_snapshot_metadata_with_length(self):
563563 expiration_date ,
564564 storage_backend ,
565565 consistent_snapshot = False ,
566- use_length = True )
566+ use_length = True )[ 0 ]
567567 self .assertTrue (tuf .formats .SNAPSHOT_SCHEMA .matches (snapshot_metadata ))
568568
569569 metadata_files_info_dict = snapshot_metadata ['meta' ]
@@ -578,7 +578,8 @@ def test_generate_snapshot_metadata_with_length(self):
578578 # In the repository, the file "role_file.xml" have been added to make
579579 # sure that non-json files aren't loaded. This file should be filtered.
580580 if stripped_filename .endswith ('.json' ):
581- if stripped_filename not in TOP_LEVEL_METADATA_FILES :
581+ if stripped_filename not in TOP_LEVEL_METADATA_FILES and \
582+ not stripped_filename .endswith ('-snapshot.json' ):
582583 # Check that length is not calculated but hashes is
583584 self .assertIn ('length' , metadata_files_info_dict [stripped_filename ])
584585 self .assertNotIn ('hashes' , metadata_files_info_dict [stripped_filename ])
@@ -594,7 +595,7 @@ def test_generate_snapshot_metadata_with_hashes(self):
594595 expiration_date ,
595596 storage_backend ,
596597 consistent_snapshot = False ,
597- use_hashes = True )
598+ use_hashes = True )[ 0 ]
598599 self .assertTrue (tuf .formats .SNAPSHOT_SCHEMA .matches (snapshot_metadata ))
599600
600601 metadata_files_info_dict = snapshot_metadata ['meta' ]
@@ -609,7 +610,8 @@ def test_generate_snapshot_metadata_with_hashes(self):
609610 # In the repository, the file "role_file.xml" have been added to make
610611 # sure that non-json files aren't loaded. This file should be filtered.
611612 if stripped_filename .endswith ('.json' ):
612- if stripped_filename not in TOP_LEVEL_METADATA_FILES :
613+ if stripped_filename not in TOP_LEVEL_METADATA_FILES and \
614+ not stripped_filename .endswith ('-snapshot.json' ):
613615 # Check that hashes is not calculated but length is
614616 self .assertNotIn ('length' , metadata_files_info_dict [stripped_filename ])
615617 self .assertIn ('hashes' , metadata_files_info_dict [stripped_filename ])
@@ -626,7 +628,7 @@ def test_generate_snapshot_metadata_with_hashes_and_length(self):
626628 storage_backend ,
627629 consistent_snapshot = False ,
628630 use_length = True ,
629- use_hashes = True )
631+ use_hashes = True )[ 0 ]
630632 self .assertTrue (tuf .formats .SNAPSHOT_SCHEMA .matches (snapshot_metadata ))
631633
632634 metadata_files_info_dict = snapshot_metadata ['meta' ]
@@ -641,7 +643,8 @@ def test_generate_snapshot_metadata_with_hashes_and_length(self):
641643 # In the repository, the file "role_file.xml" have been added to make
642644 # sure that non-json files aren't loaded. This file should be filtered.
643645 if stripped_filename .endswith ('.json' ):
644- if stripped_filename not in TOP_LEVEL_METADATA_FILES :
646+ if stripped_filename not in TOP_LEVEL_METADATA_FILES and \
647+ not stripped_filename .endswith ('-snapshot.json' ):
645648 # Check that both length and hashes are not are not calculated
646649 self .assertIn ('length' , metadata_files_info_dict [stripped_filename ])
647650 self .assertIn ('hashes' , metadata_files_info_dict [stripped_filename ])
0 commit comments