예제 #1
0
 def test_compare_key_greater(self):
     """
     Confirm the appropriate action is taken when the soruce compare key
     is greater than the destination compare key.
     """
     src_files = []
     dest_files = []
     ref_list = []
     result_list = []
     time = datetime.datetime.now()
     src_file = FileInfo(src='', dest='',
                         compare_key='domparator_test.py', size=10,
                         last_update=time, src_type='local',
                         dest_type='s3', operation_name='upload',
                         service=None, endpoint=None)
     dest_file = FileInfo(src='', dest='',
                          compare_key='comparator_test.py', size=10,
                          last_update=time, src_type='s3',
                          dest_type='local', operation_name='',
                          service=None, endpoint=None)
     src_files.append(src_file)
     dest_files.append(dest_file)
     src_file.operation = 'upload'
     dest_file.operation = 'delete'
     ref_list.append(dest_file)
     ref_list.append(src_file)
     files = self.comparator.call(iter(src_files), iter(dest_files))
     for filename in files:
         result_list.append(filename)
     self.assertEqual(result_list, ref_list)
예제 #2
0
 def test_compare_key_greater(self):
     """
     Confirm the appropriate action is taken when the soruce compare key
     is greater than the destination compare key.
     """
     src_files = []
     dest_files = []
     ref_list = []
     result_list = []
     time = datetime.datetime.now()
     src_file = FileInfo(src='', dest='',
                         compare_key='domparator_test.py', size=10,
                         last_update=time, src_type='local',
                         dest_type='s3', operation='upload')
     dest_file = FileInfo(src='', dest='',
                          compare_key='comparator_test.py', size=10,
                          last_update=time, src_type='s3',
                          dest_type='local', operation='')
     src_files.append(src_file)
     dest_files.append(dest_file)
     src_file.operation = 'upload'
     dest_file.operation = 'delete'
     ref_list.append(dest_file)
     ref_list.append(src_file)
     files = self.comparator.call(iter(src_files), iter(dest_files))
     for filename in files:
         result_list.append(filename)
     self.assertEqual(result_list, ref_list)
예제 #3
0
 def test_empty_src(self):
     """
     Confirm the appropriate action is taken when there are no more source
     files to take.
     """
     src_files = []
     dest_files = []
     ref_list = []
     result_list = []
     time = datetime.datetime.now()
     dest_file = FileInfo(
         src="",
         dest="",
         compare_key="comparator_test.py",
         size=10,
         last_update=time,
         src_type="s3",
         dest_type="local",
         operation_name="",
         service=None,
         endpoint=None,
     )
     dest_files.append(dest_file)
     dest_file.operation = "delete"
     ref_list.append(dest_file)
     files = self.comparator.call(iter(src_files), iter(dest_files))
     for filename in files:
         result_list.append(filename)
     self.assertEqual(result_list, ref_list)
예제 #4
0
 def test_empty_src(self):
     """
     Confirm the appropriate action is taken when there are no more source
     files to take.
     """
     src_files = []
     dest_files = []
     ref_list = []
     result_list = []
     time = datetime.datetime.now()
     dest_file = FileInfo(src='',
                          dest='',
                          compare_key='comparator_test.py',
                          size=10,
                          last_update=time,
                          src_type='s3',
                          dest_type='local',
                          operation_name='',
                          service=None,
                          endpoint=None)
     dest_files.append(dest_file)
     dest_file.operation = 'delete'
     ref_list.append(dest_file)
     files = self.comparator.call(iter(src_files), iter(dest_files))
     for filename in files:
         result_list.append(filename)
     self.assertEqual(result_list, ref_list)
예제 #5
0
 def test_compare_key_less(self):
     """
     Confirm the appropriate action is taken when the soruce compare key
     is less than the destination compare key.
     """
     src_files = []
     dest_files = []
     ref_list = []
     result_list = []
     time = datetime.datetime.now()
     src_file = FileInfo(
         src="",
         dest="",
         compare_key="bomparator_test.py",
         size=10,
         last_update=time,
         src_type="local",
         dest_type="s3",
         operation_name="upload",
         service=None,
         endpoint=None,
     )
     dest_file = FileInfo(
         src="",
         dest="",
         compare_key="comparator_test.py",
         size=10,
         last_update=time,
         src_type="s3",
         dest_type="local",
         operation_name="",
         service=None,
         endpoint=None,
     )
     src_files.append(src_file)
     dest_files.append(dest_file)
     dest_file.operation = "delete"
     ref_list.append(src_file)
     ref_list.append(dest_file)
     files = self.comparator.call(iter(src_files), iter(dest_files))
     for filename in files:
         result_list.append(filename)
     self.assertEqual(result_list, ref_list)