def test_parse_update(self): async_result = AsyncResult(client=None) update = {'@type': 'some_type', 'some': 'data'} async_result.parse_update(update) assert async_result.error is False assert async_result.error_info is None assert async_result.update == update assert async_result.ok_received is False
def test_parse_update_ok(self): ar = AsyncResult(client=None) update = {'@type': 'ok', 'some': 'data'} ar.parse_update(update) assert ar.error is False assert ar.error_info is None assert ar.update is None assert ar.ok_received is True
def test_parse_update_ok(self): async_result = AsyncResult(client=None) update = {'@type': 'ok', 'some': 'data'} async_result.parse_update(update) assert async_result.error is False assert async_result.error_info is None assert async_result.update is None assert async_result.ok_received is True assert async_result._ready.is_set() is True
def test_parse_update_with_error(self): ar = AsyncResult(client=None) update = { '@type': 'error', 'some': 'data', } assert ar.error is False assert ar.error_info is None ar.parse_update(update) assert ar.error is True assert ar.error_info == update assert ar.update is None assert ar.ok_received is False
def test_parse_update_authorization_state_ok(self): # when id=updateAuthorizationState # and @type=ok # it should not set async_result._ready # because for updateAuthorizationState we want to wait for the # next message with result_id=updateAuthorizationState async_result = AsyncResult( client=None, result_id='updateAuthorizationState', ) update = {'@type': 'ok', 'some': 'data'} async_result.parse_update(update) assert async_result.error is False assert async_result.error_info is None assert async_result.update is None assert async_result.ok_received is True assert async_result._ready.is_set() is False