Ejemplo n.º 1
0
 def test_total_items(self, mock_path_data, mock_os):
     counter = LocalOnlyCounter(bytes_per_chunk=100)
     self.assertEqual(0, counter.total_items())
     f = LocalFile('fakefile.txt')
     f.size = 0
     counter.visit_file(f, None)
     self.assertEqual(1, counter.total_items())
     f = LocalFile('fakefile2.txt')
     f.size = 200
     counter.visit_file(f, None)
     self.assertEqual(3, counter.total_items())
Ejemplo n.º 2
0
 def test_total_items(self, mock_path_data, mock_os):
     counter = LocalOnlyCounter(bytes_per_chunk=100)
     self.assertEqual(0, counter.total_items())
     f = LocalFile('fakefile.txt')
     f.size = 0
     counter.visit_file(f, None)
     self.assertEqual(1, counter.total_items())
     f = LocalFile('fakefile2.txt')
     f.size = 200
     counter.visit_file(f, None)
     self.assertEqual(3, counter.total_items())
Ejemplo n.º 3
0
 def test_count_chunks_values(self, mock_path_data, mock_os):
     values = [
         # file_size, bytes_per_chunk, expected
         (200, 10, 20),
         (200, 150, 2),
         (3, 150, 1),
         (0, 10, 1),  # Empty files must send 1 empty chunk to DukeDS
     ]
     f = LocalFile('fakefile.txt')
     for file_size, bytes_per_chunk, expected in values:
         f.size = file_size
         self.assertEqual(expected, f.count_chunks(bytes_per_chunk))
Ejemplo n.º 4
0
 def test_count_chunks_values(self, mock_path_data, mock_os):
     values = [
         # file_size, bytes_per_chunk, expected
         (200, 10, 20),
         (200, 150, 2),
         (3, 150, 1),
         (0, 10, 1),  # Empty files must send 1 empty chunk to DukeDS
     ]
     f = LocalFile('fakefile.txt')
     for file_size, bytes_per_chunk, expected in values:
         f.size = file_size
         self.assertEqual(expected, f.count_chunks(bytes_per_chunk))