Changeset 157

Show
Ignore:
Timestamp:
2002-04-01 13:58:28 (7 years ago)
Author:
schwa
Message:
TestStat.test_lstat_one_file/test_lstat_one_dir: checking st_target
    field of _Stat object.
Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/_test_ftputil.py

    r152 r157  
    3030# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
    3131 
    32 # $Id: _test_ftputil.py,v 1.56 2002/03/31 23:20:35 schwa Exp $ 
     32# $Id: _test_ftputil.py,v 1.57 2002/04/01 13:58:28 schwa Exp $ 
    3333 
    3434import unittest 
     
    9494    def upload(self, source, target, mode=''): 
    9595        assert 0, "FTPHost.upload should not have been called" 
    96      
     96 
    9797    def download(self, source, target, mode=''): 
    9898        assert 0, "FTPHost.download should not have been called" 
     
    121121        self.assertEqual(host.closed, 1) 
    122122        self.assertEqual(host._children, []) 
    123      
     123 
    124124 
    125125class TestLogin(unittest.TestCase): 
    126      
     126 
    127127    def test_invalid_login(self): 
    128128        """Login to invalid host must fail.""" 
     
    146146 
    147147    def test_lstat_one_file(self): 
    148         """Test FTPHost.lstat for a file.""" 
     148        """Test lstat for a file.""" 
    149149        host = ftp_host_factory() 
    150150        stat_result = host.lstat('/home/sschwarzer/index.html') 
    151151        self.assertEqual( oct(stat_result.st_mode), '0100644' ) 
    152152        self.assertEqual(stat_result.st_size, 4604) 
     153        self.assertEqual(stat_result.st_name, 'index.html') 
     154        self.assertEqual(stat_result.st_target, None) 
    153155 
    154156    def test_lstat_one_dir(self): 
    155         """Test FTPHost.lstat for a directory.""" 
    156         # some directory 
     157        """Test lstat for a directory.""" 
    157158        host = ftp_host_factory() 
    158159        stat_result = host.lstat('/home/sschwarzer/scios2') 
     
    168169        self.assertEqual(stat_result.st_ctime, None) 
    169170        self.assertEqual(stat_result.st_name, 'scios2') 
     171        self.assertEqual(stat_result.st_target, None) 
    170172 
    171173    def test_lstat_via_stat_module(self): 
    172         """Test FTPHost.lstat indirectly via stat module.""" 
     174        """Test lstat indirectly via stat module.""" 
    173175        host = ftp_host_factory() 
    174176        stat_result = host.lstat('/home/sschwarzer/') 
    175177        self.failUnless( stat.S_ISDIR(stat_result.st_mode) ) 
    176178 
     179#     def test_stat_following_link(self): 
     180#         """Test stat when invoked on a link.""" 
     181#         host = ftp_host_factory() 
     182#         stat_result = host.lstat('/home/a_link') 
     183#         self.failUnless(stat_result.st_name,  
    177184 
    178185class TestListdir(unittest.TestCase): 
     
    408415        source_file.write(data) 
    409416        source_file.close() 
    410          
     417 
    411418    def test_ascii_upload(self): 
    412419        """Test ASCII mode upload.""" 
     
    464471        # clean up 
    465472        os.unlink(local_source) 
    466          
     473 
    467474    def compare_and_delete_downloaded_data(self, filename): 
    468475        """Compare content of downloaded file with its source, then