def test_getTargetMovies_filterHiddenItems(self): allMovies = ['/home/sam/movie/.AppleDouble'] ftpMock = FTP('') ftpMock.nlst = MagicMock(return_value=allMovies) util = Utils() util.isHidden = MagicMock(return_value=True) source = '/home/sam/movie' transfer = Transfer(ftpMock, util, None) result = transfer.getFiles(source) ftpMock.nlst.assert_called_with(source) self.assertTrue(allMovies[0] not in result) self.assertEqual(0, len(result))
def test_getFiles_allItems(self): allMovies = ['/home/sam/movie/transformers.mp4', '/home/sam/movie/walking.mp4'] ftpMock = FTP('') ftpMock.nlst = MagicMock(return_value=allMovies) util = Utils() util.isHidden = MagicMock(return_value=False) source = '/home/sam/movie' transfer = Transfer(ftpMock, util, None) result = transfer.getFiles(source) ftpMock.nlst.assert_called_with(source) self.assertTrue(allMovies[0] in result) self.assertTrue(allMovies[1] in result)
def test_getFiles_allItems(self): allMovies = [ '/home/sam/movie/transformers.mp4', '/home/sam/movie/walking.mp4' ] ftpMock = FTP('') ftpMock.nlst = MagicMock(return_value=allMovies) util = Utils() util.isHidden = MagicMock(return_value=False) source = '/home/sam/movie' transfer = Transfer(ftpMock, util, None) result = transfer.getFiles(source) ftpMock.nlst.assert_called_with(source) self.assertTrue(allMovies[0] in result) self.assertTrue(allMovies[1] in result)