Show
Ignore:
Timestamp:
12/17/09 12:00:01 (2 years ago)
Author:
Menno Smits <menno@…>
Branch:
default
Message:

committing response parser progress so far, lots of failing tests

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • imapclient/test/test_response_parser.py

    r107 r109  
    129129    return dt.astimezone(system_offset).replace(tzinfo=None) 
    130130 
    131 class TestPatchFetchResponse(object): 
     131class TestParseFetchResponse(unittest.TestCase): 
    132132 
    133133    def test_basic(self): 
    134         parse_fetch_response('4 FETCH ()', {'4': {}}) 
     134        self.assertEquals(parse_fetch_response('* 4 FETCH ()'), {4: {}}) 
     135 
     136 
     137    def test_simple_pair(self): 
     138        self.assertEquals(parse_fetch_response('* 23 FETCH (ABC 123 STUFF "hello")'), 
     139                          {'23': {'ABC': 123, 
     140                                  'STUFF': 'hello'}}) 
     141 
    135142 
    136143    def test_non_fetch(self): 
    137         self.assertRaises(ParseError, parse_fetch_response, '4 OTHER ()') 
     144        self.assertRaises(ParseError, parse_fetch_response, '* 4 OTHER ()') 
     145 
     146 
     147    def test_bad_msgid(self): 
     148        self.assertRaises(ParseError, parse_fetch_response, '* abc FETCH ()') 
     149 
    138150 
    139151    def test_UID(self): 
    140         self.fail() 
    141 #         '''Test UID handling. The UID is returned instead of the given message 
    142 #         ID if present. 
    143 #         ''' 
    144 #         self._parse_test( 
    145 #             ['1 (UID 8)'], 
    146 #             {8: {}} 
    147 #             ) 
     152        self.assertEquals(parse_fetch_response('* 23 FETCH (UID 76)'), 
     153                          {'76': {}}) 
    148154 
    149155 
     
    177183 
    178184    def test_multiple_fields(self): 
     185        self.fail() 
     186 
     187    def test_multiple_messages(self): 
    179188        self.fail() 
    180189