<s> import datetime <EOL> from awscli . customizations . s3 . filegenerator import FileStat <EOL> from awscli . customizations . s3 . syncstrategy . exacttimestamps import ExactTimestampsSync <EOL> from awscli . testutils import unittest <EOL> class TestExactTimestampsSync ( unittest . TestCase ) : <EOL> def setUp ( self ) : <EOL> self . sync_strategy = ExactTimestampsSync ( ) <EOL> def test_compare_exact_timestamps_dest_older ( self ) : <EOL> """<STR_LIT>""" <EOL> time_src = datetime . datetime . now ( ) <EOL> time_dst = time_src - datetime . timedelta ( days = <NUM_LIT:1> ) <EOL> src_file = FileStat ( src = '<STR_LIT>' , dest = '<STR_LIT>' , <EOL> compare_key = '<STR_LIT>' , size = <NUM_LIT:10> , <EOL> last_update = time_src , src_type = '<STR_LIT>' , <EOL> dest_type = '<STR_LIT>' , operation_name = '<STR_LIT>' ) <EOL> dst_file = FileStat ( src = '<STR_LIT>' , dest = '<STR_LIT>' , <EOL> compare_key = '<STR_LIT>' , size = <NUM_LIT:10> , <EOL> last_update = time_dst , src_type = '<STR_LIT>' , <EOL> dest_type = '<STR_LIT>' , operation_name = '<STR_LIT>' ) <EOL> should_sync = self . sync_strategy . determine_should_sync ( <EOL> src_file , dst_file ) <EOL> self . assertTrue ( should_sync ) <EOL> def test_compare_exact_timestamps_src_older ( self ) : <EOL> """<STR_LIT>""" <EOL> time_src = datetime . datetime . now ( ) - datetime . timedelta ( days = <NUM_LIT:1> ) <EOL> time_dst = datetime . datetime . now ( ) <EOL> src_file = FileStat ( src = '<STR_LIT>' , dest = '<STR_LIT>' , <EOL> compare_key = '<STR_LIT>' , size = <NUM_LIT:10> , <EOL> last_update = time_src , src_type = '<STR_LIT>' , <EOL> dest_type = '<STR_LIT>' , operation_name = '<STR_LIT>' ) <EOL> dst_file = FileStat ( src = '<STR_LIT>' , dest = '<STR_LIT>' , <EOL> compare_key = '<STR_LIT>' , size = <NUM_LIT:10> , <EOL> last_update = time_dst , src_type = '<STR_LIT>' , <EOL> dest_type = '<STR_LIT>' , operation_name = '<STR_LIT>' ) <EOL> should_sync = self . sync_strategy . determine_should_sync ( <EOL> src_file , dst_file ) <EOL> self . assertTrue ( should_sync ) <EOL> def test_compare_exact_timestamps_same_age_same_size ( self ) : <EOL> """<STR_LIT>""" <EOL> time_both = datetime . datetime . now ( ) <EOL> src_file = FileStat ( src = '<STR_LIT>' , dest = '<STR_LIT>' , <EOL> compare_key = '<STR_LIT>' , size = <NUM_LIT:10> , <EOL> last_update = time_both , src_type = '<STR_LIT>' , <EOL> dest_type = '<STR_LIT>' , operation_name = '<STR_LIT>' ) <EOL> dst_file = FileStat ( src = '<STR_LIT>' , dest = '<STR_LIT>' , <EOL> compare_key = '<STR_LIT>' , size = <NUM_LIT:10> , <EOL> last_update = time_both , src_type = '<STR_LIT>' , <EOL> dest_type = '<STR_LIT>' , operation_name = '<STR_LIT>' ) <EOL> should_sync = self . sync_strategy . determine_should_sync ( <EOL> src_file , dst_file ) <EOL> self . assertFalse ( should_sync ) <EOL> def test_compare_exact_timestamps_same_age_diff_size ( self ) : <EOL> """<STR_LIT>""" <EOL> time_both = datetime . datetime . now ( ) <EOL> src_file = FileStat ( src = '<STR_LIT>' , dest = '<STR_LIT>' , <EOL> compare_key = '<STR_LIT>' , size = <NUM_LIT:20> , <EOL> last_update = time_both , src_type = '<STR_LIT>' , <EOL> dest_type = '<STR_LIT>' , operation_name = '<STR_LIT>' ) <EOL> dst_file = FileStat ( src = '<STR_LIT>' , dest = '<STR_LIT>' , <EOL> compare_key = '<STR_LIT>' , size = <NUM_LIT:10> , <EOL> last_update = time_both , src_type = '<STR_LIT>' , <EOL> dest_type = '<STR_LIT>' , operation_name = '<STR_LIT>' ) <EOL> should_sync = self . sync_strategy . determine_should_sync ( <EOL> src_file , dst_file ) <EOL> self . assertTrue ( should_sync ) <EOL> def test_compare_exact_timestamps_diff_age_not_download ( self ) : <EOL> """<STR_LIT>""" <EOL> time_src = datetime . datetime . now ( ) <EOL> time_dst = time_src - datetime . timedelta ( days = <NUM_LIT:1> ) <EOL> src_file = FileStat ( src = '<STR_LIT>' , dest = '<STR_LIT>' , <EOL> compare_key = '<STR_LIT>' , size = <NUM_LIT:10> , <EOL> last_update = time_src , src_type = '<STR_LIT>' , <EOL> dest_type = '<STR_LIT>' , operation_name = '<STR_LIT>' ) <EOL> dst_file = FileStat ( src = '<STR_LIT>' , dest = '<STR_LIT>' , <EOL> compare_key = '<STR_LIT>' , size = <NUM_LIT:10> , <EOL> last_update = time_dst , src_type = '<STR_LIT>' , <EOL> dest_type = '<STR_LIT>' , operation_name = '<STR_LIT>' ) <EOL> should_sync = self . sync_strategy . determine_should_sync ( <EOL> src_file , dst_file ) <EOL> self . assertTrue ( should_sync ) <EOL> if __name__ == "<STR_LIT:__main__>" : <EOL> unittest . main ( ) </s>
