Changeset 216:5f6de1d4618c

Show
Ignore:
Timestamp:
15/04/11 12:49:34 (13 months ago)
Author:
Menno Smits <menno@…>
Branch:
default
Message:

getacl() was still using Lexer instead of TokenSource? (fixes #85)

Also added getacl() unit test.

Location:
imapclient
Files:
2 modified

Legend:

Unmodified
Added
Removed
  • imapclient/imapclient.py

    r209 r216  
    657657        self._checkok('getacl', typ, data) 
    658658 
    659         parts = list(response_lexer.Lexer([data[0]])) 
     659        parts = list(response_lexer.TokenSource(data)) 
    660660        parts = parts[1:]       # First item is folder name 
    661  
    662         out = [] 
    663         for i in xrange(0, len(parts), 2): 
    664             out.append((parts[i], parts[i+1])) 
    665         return out 
     661        return [(parts[i], parts[i+1]) for i in xrange(0, len(parts), 2)] 
    666662 
    667663 
  • imapclient/test/test_IMAPClient.py

    r204 r216  
    157157 
    158158 
     159class TestAclMethods(IMAPClientTest): 
     160 
     161    def test_getacl(self): 
     162        self.client._imap.getacl.return_value = ('OK', ['INBOX Fred rwipslda Sally rwip']) 
     163        acl = self.client.getacl('INBOX') 
     164        self.assertSequenceEqual(acl, [('Fred', 'rwipslda'), ('Sally', 'rwip')]) 
     165 
    159166 
    160167if __name__ == '__main__':