Ticket #1333: 1333-1.diff
| File 1333-1.diff, 2.0 KB (added by adiroiban, 4 months ago) |
|---|
-
twisted/test/test_ftp.py
509 509 return downloader.buffer 510 510 return chainDeferred.addCallback(downloadDone) 511 511 512 def testEmptyLIST(self): 513 # Login 512 def test_LISTEmpty(self): 513 """ 514 When listing empty folders, LIST returns an empty response. 515 """ 514 516 d = self._anonymousLogin() 515 517 516 518 # No files, so the file listing should be empty … … 519 521 self.assertEqual('', result) 520 522 return d.addCallback(checkEmpty) 521 523 522 def testLISTWithBinLsFlags(self): 523 # Make some directories 524 def test_LISTWithBinLsFlags(self): 525 """ 526 LIST ignores requests for folder with names like '-al' and will list 527 the content of current folder. 528 """ 524 529 os.mkdir(os.path.join(self.directory, 'foo')) 525 530 os.mkdir(os.path.join(self.directory, 'bar')) 526 531 … … 528 533 d = self._anonymousLogin() 529 534 530 535 self._download('LIST -aL', chainDeferred=d) 536 531 537 def checkDownload(download): 532 # We expect 2 lines because there are two files in the root. 533 self.assertEqual(2, len(download[:-2].split('\r\n'))) 538 list_folder_names = [] 539 for line in download.splitlines(): 540 list_folder_names.append(line.split(' ')[-1]) 541 self.assertEqual(2, len(list_folder_names)) 542 self.assertTrue('foo' in list_folder_names) 543 self.assertTrue('bar' in list_folder_names) 544 534 545 return d.addCallback(checkDownload) 535 546 536 def testTwoDirLIST(self): 537 # Make some directories 547 def test_LISTWithContent(self): 548 """ 549 LIST returns all folder's members, each member listed on a separate 550 line and with name and other details. 551 """ 538 552 os.mkdir(os.path.join(self.directory, 'foo')) 539 553 os.mkdir(os.path.join(self.directory, 'bar')) 540 554
