Changeset 139:be5626eee037

Show
Ignore:
Timestamp:
17/03/10 02:10:37 (23 months ago)
Author:
Menno Smits <menno@…>
Branch:
default
Message:

Added tests for partial fetches

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • livetest.py

    r138 r139  
    330330                                   None, None, None, 
    331331                                   '<1A472770E042064698CB5ADC83A12ACD39455AAB@ABC>') 
    332      
     332 
     333 
     334def test_partial_fetch(client): 
     335    clear_folder(client, 'INBOX') 
     336    client.append('INBOX', MULTIPART_MESSAGE) 
     337    client.select_folder('INBOX') 
     338    msg_id = client.search()[0] 
     339 
     340    resp = client.fetch(msg_id, ['BODY[]<0.20>']) 
     341    body = resp[msg_id]['BODY[]<0>'] 
     342    assert len(body) == 20 
     343    assert body.startswith('From: Bob Smith') 
     344 
     345    resp = client.fetch(msg_id, ['BODY[]<2.25>']) 
     346    body = resp[msg_id]['BODY[]<2>'] 
     347    assert len(body) == 25 
     348    assert body.startswith('om: Bob Smith') 
     349 
    333350 
    334351def assert_raises(exception_class, func, *args, **kwargs): 
     
    357374    test_search(client) 
    358375    test_fetch(client) 
     376    test_partial_fetch(client) 
    359377    test_copy(client) 
    360378