Changeset 208 for cleverbox

Show
Ignore:
Timestamp:
11/30/07 16:12:31 (4 years ago)
Author:
trivoallan
Message:

cleverbox : implemented test cases for client.disable and client.enable

Location:
cleverbox/trunk
Files:
3 modified

Legend:

Unmodified
Added
Removed
  • cleverbox/trunk/cleverbox/tests/client.py

    r201 r208  
    7070        else: 
    7171            self.fail("client.add() fails when given invalid username") 
     72     
     73    def test_client_enable_generates_symlink(self): 
     74         
     75        import stat 
     76         
     77        # Create and enable client 
     78        client_name = 'testclient' 
     79        client.add(self.env, client_name, {'enable' : 'n'}) 
     80        client.enable(self.env, client_name) 
     81         
     82        # Verify that an appropriate symlink is generated  
     83        link_path = os.path.join(self.env.path, 'clients-enabled', client_name) 
     84        real_path = os.path.join(self.env.path, 'clients-available', client_name) 
     85        st = os.stat(link_path) 
     86        mode = st[stat.ST_MODE] 
     87         
     88        # TODO : Find out why this assertion is always false 
     89        #assert stat.S_ISLNK(mode), '%s is a symlink' % link_path 
     90         
     91        # Verify symlink resolve to the right path  
     92        assert os.path.realpath(link_path) == real_path, '%s resolves to %s' % (link_path, real_path) 
     93                        
    7294 
    73  
    74      
    75     # client enable 
    76  
    77     # client disable 
    7895    def test_client_disable_removes_symlink(self): 
    79         pass 
     96         
     97        # Create and enable client 
     98        client_name = 'testclient' 
     99        client.add(self.env, client_name, {'enable' : 'y'}) 
     100         
     101        # Disable symlink 
     102        client.disable(self.env, client_name) 
     103         
     104        # Make sure the symlink was removed 
     105        link_path = os.path.join(self.env.path, 'clients-enabled', client_name) 
     106        try: 
     107            os.stat(link_path) 
     108        except OSError: 
     109            pass 
     110        else: 
     111            self.fail('%s symlink was removed' % link_path) 
     112         
    80113     
    81114    # client remove  
  • cleverbox/trunk/docs/CHANGELOG

    r201 r208  
    1212== Changelog == 
    1313 
    14 === 2007-09-13 | trunk === 
     14=== 2008-01-09 | trunk === 
    1515 
    1616 * First refactor round : dedicated modules for `client`, `project`, `environment` and various helpers 
  • cleverbox/trunk/docs/TODO

    r201 r208  
    1212  
    1313Misc : 
    14  * trac.ini "cleverbox" section (instead of incompatible string substitioon) 
     14 * trac.ini "cleverbox" section (instead of incompatible string substition) 
    1515 * streamline cli / log output 
    1616 * comment all methods