Exemplo n.º 1
0
    def test_path_size_does_not_list_dir_if_path_is_not_dir(self):
        self.os.path.isdir.return_value = False

        path_size('somepath')

        self.os.path.isdir.assert_called_once_with('somepath')
        self.assertEqual(0, len(self.os.path.listdir.mock_calls))
Exemplo n.º 2
0
 def enough_space(file_entry, remote_driver):
     filename, _ = file_entry
     bytes_in_buffer = path_size(MESSOR_BUFFER) + remote_driver.file_size(filename)
     return bytes_in_buffer < LIMIT_IN_BYTES
Exemplo n.º 3
0
    def test_path_size_returns_summed_item_sizes_in_bytes(self):
        self.os.path.getsize.return_value = 5
        self.os.path.isdir.side_effect = [True, False]

        ret = path_size('somepath')
        self.assertEqual(ret, 5)
Exemplo n.º 4
0
    def test_path_size_lists_dir_if_path_is_dir(self):
        self.os.path.isdir.side_effect = [True, False]

        path_size('somepath')

        self.os.listdir.assert_called_once_with('somepath')
Exemplo n.º 5
0
    def test_path_size_gets_size_of_path(self):
        path_size('somepath')

        self.os.path.getsize.assert_called_once_with('somepath')