fix(douyu): 修正扫码前待确认角色误判
This commit is contained in:
@@ -195,7 +195,7 @@ def test_existing_pending_role_is_baseline_not_new_scan_result():
|
||||
)
|
||||
|
||||
|
||||
def test_existing_action_alias_pending_is_confirmable_even_same_role():
|
||||
def test_existing_action_alias_pending_is_stale_without_transition():
|
||||
role = "忧郁情潇藏心中"
|
||||
baseline = _role_candidate(ACT_ALIAS, role, need_bind_act=True)
|
||||
legacy = _role_candidate(LEGACY_ALIAS, role, need_bind_act=False)
|
||||
@@ -209,20 +209,18 @@ def test_existing_action_alias_pending_is_confirmable_even_same_role():
|
||||
baseline_info=baseline,
|
||||
actionable_aliases=[ACT_ALIAS],
|
||||
)
|
||||
selected = picker._pick_bind_info(
|
||||
selected = picker._pick_pending_role_info(
|
||||
[legacy, activity],
|
||||
prefer_aliases=[LEGACY_ALIAS, ACT_ALIAS],
|
||||
baseline_role_name=role,
|
||||
baseline_is_bound_act=False,
|
||||
baseline_info=baseline,
|
||||
prefer_pending=True,
|
||||
prefer_aliases=[LEGACY_ALIAS, ACT_ALIAS],
|
||||
actionable_aliases=[ACT_ALIAS],
|
||||
)
|
||||
|
||||
assert decision["confirmable"] is True
|
||||
assert decision["reason"] == "existing_actionable_pending"
|
||||
assert selected is not None
|
||||
assert selected["act_alias"] == ACT_ALIAS
|
||||
assert decision["confirmable"] is False
|
||||
assert decision["reason"] == "same_role_stale_pending"
|
||||
assert selected is None
|
||||
|
||||
|
||||
def test_same_role_after_activity_bind_transition_is_pending():
|
||||
@@ -238,7 +236,7 @@ def test_same_role_after_activity_bind_transition_is_pending():
|
||||
)
|
||||
|
||||
|
||||
def test_same_bound_role_with_need_bind_act_is_confirmable():
|
||||
def test_same_bound_role_with_need_bind_act_is_not_confirmable_without_transition():
|
||||
role = "少和我较劲"
|
||||
baseline = _role_candidate(
|
||||
ACT_ALIAS,
|
||||
@@ -261,11 +259,11 @@ def test_same_bound_role_with_need_bind_act_is_confirmable():
|
||||
actionable_aliases=[ACT_ALIAS],
|
||||
)
|
||||
|
||||
assert decision["confirmable"] is True
|
||||
assert decision["reason"] == "same_alias_after_bound_transition"
|
||||
assert decision["confirmable"] is False
|
||||
assert decision["reason"] == "already_bound"
|
||||
|
||||
|
||||
def test_pending_candidate_picker_uses_action_alias_same_role():
|
||||
def test_pending_candidate_picker_ignores_unchanged_same_role():
|
||||
old_role = "少和我较劲"
|
||||
baseline = _role_candidate(ACT_ALIAS, old_role, bound_act=True)
|
||||
legacy = _role_candidate(LEGACY_ALIAS, old_role, bound_act=False)
|
||||
@@ -279,6 +277,23 @@ def test_pending_candidate_picker_uses_action_alias_same_role():
|
||||
baseline_info=baseline,
|
||||
)
|
||||
|
||||
assert selected is None
|
||||
|
||||
|
||||
def test_pending_candidate_picker_accepts_same_alias_state_transition():
|
||||
role = "少和我较劲"
|
||||
baseline = _role_candidate(ACT_ALIAS, role, bound_act=True, need_bind_act=False)
|
||||
after_scan = _role_candidate(ACT_ALIAS, role, bound_act=False, need_bind_act=True)
|
||||
|
||||
selected = _RolePicker()._pick_pending_role_info(
|
||||
[after_scan],
|
||||
prefer_aliases=[ACT_ALIAS],
|
||||
baseline_role_name=role,
|
||||
baseline_is_bound_act=True,
|
||||
baseline_info=baseline,
|
||||
actionable_aliases=[ACT_ALIAS],
|
||||
)
|
||||
|
||||
assert selected is not None
|
||||
assert selected["act_alias"] == ACT_ALIAS
|
||||
|
||||
|
||||
Reference in New Issue
Block a user