#NEWLINE# def test_invokes_digest_validator( self ) : #NEWLINE# #INDENT# start_date = START_DATE #NEWLINE# end_date = END_DATE #NEWLINE# key_name = ( end_date . strftime ( DATE_FORMAT ) + '.json.gz' ) #NEWLINE# digest = { #NEWLINE# #INDENT# 'digestPublicKeyFingerprint' : 'a' , #NEWLINE# 'digestS3Bucket' : '1' , #NEWLINE# 'digestS3Object' : key_name , #NEWLINE# 'previousDigestSignature' : '...' , #NEWLINE# 'digestStartTime' : ( end_date - timedelta ( hours = 1 ) ) . strftime ( DATE_FORMAT ) , #NEWLINE# 'digestEndTime' : end_date . strftime ( DATE_FORMAT ) , #NEWLINE# #UNINDENT# } #NEWLINE# digest_provider = Mock ( ) #NEWLINE# digest_provider . load_digest_keys_in_range . return_value = [ key_name ] #NEWLINE# digest_provider . fetch_digest . return_value = ( digest , key_name ) #NEWLINE# key_provider = Mock ( ) #NEWLINE# public_keys = { #NEWLINE# #INDENT# 'a' : { #NEWLINE# #INDENT# 'Fingerprint' : 'a' , #NEWLINE# 'Value' : 'a' , #NEWLINE# #UNINDENT# } , #NEWLINE# #UNINDENT# } #NEWLINE# key_provider . get_public_keys . return_value = public_keys #NEWLINE# digest_validator = Mock ( ) #NEWLINE# traverser = DigestTraverser ( digest_provider = digest_provider , starting_bucket = '1' , starting_prefix = 'baz' , public_key_provider = key_provider , digest_validator = digest_validator ) #NEWLINE# digest_iter = traverser . traverse ( start_date , end_date ) #NEWLINE# self . assertEqual ( digest , next ( digest_iter ) ) #NEWLINE# digest_validator . validate . assert_called_with ( '1' , key_name , public_keys [ 'a' ] [ 'Value' ] , digest , key_name )