def test_events_are_condensed(api_client, message):
 ts = int((time.time() + 22))
 cursor = get_cursor(api_client, ts)
 message_id = api_client.get_data('/messages/')[0]['id']
 message_path = '/messages/{}'.format(message_id)
 api_client.put_data(message_path, {'unread': True})
 api_client.put_data(message_path, {'unread': False})
 api_client.put_data(message_path, {'unread': True})
 sync_data = api_client.get_data('/delta?cursor={}'.format(cursor))
 deltas = sync_data['deltas']
 message_deltas = [d for d in deltas if (d['object'] == 'message')]
 assert (len(message_deltas) == 1)
 delta = message_deltas[0]
 assert ((delta['object'] == 'message') and (delta['event'] == 'modify'))
 assert (delta['attributes']['unread'] is True)

def test_events_are_condensed ( api_client , message ) : ts = int ( ( time . time ( ) + 22 ) ) cursor = get_cursor ( api_client , ts ) message_id = api_client . get_data ( '/messages/' ) [ 0 ] [ 'id' ] message_path = '/messages/{}' . format ( message_id ) api_client . put_data ( message_path , { 'unread' : True } ) api_client . put_data ( message_path , { 'unread' : False } ) api_client . put_data ( message_path , { 'unread' : True } ) sync_data = api_client . get_data ( '/delta?cursor={}' . format ( cursor ) ) deltas = sync_data [ 'deltas' ] message_deltas = [ d for d in deltas if ( d [ 'object' ] == 'message' ) ] assert ( len ( message_deltas ) == 1 ) delta = message_deltas [ 0 ] assert ( ( delta [ 'object' ] == 'message' ) and ( delta [ 'event' ] == 'modify' ) ) assert ( delta [ 'attributes' ] [ 'unread' ] is True )
test that multiple revisions of the same object are rolled up in the delta response .