mirror of
https://github.com/langbot-app/LangBot.git
synced 2026-11-01 05:15:22 +08:00
test(interaction): update legacy admission assertions
This commit is contained in:
@@ -139,7 +139,7 @@ async def test_submission_is_scope_checked_and_consumed_once(store):
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
async def test_delivery_result_can_be_resolved_for_scoped_update(store):
|
||||
async def test_delivery_result_remains_available_for_callback_update(store):
|
||||
_, token = await _create(store)
|
||||
assert await store.record_delivery_success(
|
||||
'run-1',
|
||||
@@ -159,16 +159,7 @@ async def test_delivery_result_can_be_resolved_for_scoped_update(store):
|
||||
{'message_id': 'message-1', 'card_id': 'card-1', 'sequence': 1, 'rich': True},
|
||||
)
|
||||
|
||||
target = await store.find_update_target(
|
||||
interaction_id='form-1',
|
||||
binding_id='binding-1',
|
||||
runner_id='plugin:test/ApprovalRunner/default',
|
||||
processor_type='pipeline',
|
||||
processor_id='pipeline-1',
|
||||
bot_id='bot-1',
|
||||
conversation_id='group_chat-1',
|
||||
actor_id='user-1',
|
||||
)
|
||||
target = await store.get_by_callback_token(token)
|
||||
assert target['delivery_result'] == {
|
||||
'message_id': 'message-1',
|
||||
'card_id': 'card-1',
|
||||
@@ -176,20 +167,6 @@ async def test_delivery_result_can_be_resolved_for_scoped_update(store):
|
||||
'rich': True,
|
||||
}
|
||||
|
||||
assert (
|
||||
await store.find_update_target(
|
||||
interaction_id='form-1',
|
||||
binding_id='binding-1',
|
||||
runner_id='plugin:test/ApprovalRunner/default',
|
||||
processor_type='pipeline',
|
||||
processor_id='pipeline-1',
|
||||
bot_id='bot-1',
|
||||
conversation_id='group_chat-1',
|
||||
actor_id='other-user',
|
||||
)
|
||||
is None
|
||||
)
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
async def test_scope_mismatch_does_not_consume_request(store):
|
||||
|
||||
@@ -105,17 +105,12 @@ def test_conversation_authority_is_captured_before_runner_returns():
|
||||
|
||||
old, new = NS(), NS()
|
||||
config = planner(SOURCE)['config']
|
||||
query = NS(pipeline_config=config, pipeline_uuid='one', session=NS(using_conversation=new))
|
||||
binding = NS(
|
||||
processor_type='pipeline', processor_id='one', runner_id=RID, runner_config=config['ai']['runner_config'][RID]
|
||||
)
|
||||
authority = InteractionManager._pipeline_admission(
|
||||
binding,
|
||||
NS(id=RID),
|
||||
{
|
||||
'_query': query,
|
||||
'_pipeline_expected_config': copy.deepcopy(config),
|
||||
'_pipeline_conversation': old,
|
||||
},
|
||||
query = NS(pipeline_config=config, pipeline_uuid='one', session=NS(using_conversation=old))
|
||||
authority = InteractionManager._pipeline_tool_admission(
|
||||
{'execution_query': query},
|
||||
{'processor_type': 'pipeline', 'processor_id': 'one'},
|
||||
RID,
|
||||
)
|
||||
assert authority['authority_check']() is True
|
||||
query.session.using_conversation = new
|
||||
assert authority['authority_check']() is False
|
||||
|
||||
Reference in New Issue
Block a user