fix: prejoin fansclub before reservation
This commit is contained in:
1 parent
f95832579a
commit
ba9ac4cb0e
6 files changed
+300
-17
No files matched your search
@@ -50,6 +50,42 @@ def test_high_value_countdown_gt_records_reservation_and_returns_true():
|
||||
analyser.swipe_up_to_next_live.assert_called_once()
|
||||
|
||||
|
||||
def test_high_value_reservation_prejoins_fansclub_before_recording():
|
||||
analyser = _mk_analyser()
|
||||
analyser.auto_join_fansclub = True
|
||||
analyser.button_text_raw = "加入购物粉丝团并关注主播"
|
||||
future_ts = time.time() + 300
|
||||
detail = ("高价值福袋", "05:00", 10, 1, 1999.0, (time.time(), future_ts, 300))
|
||||
events = []
|
||||
|
||||
def _fake_prejoin(_analyser, _button_text):
|
||||
events.append("prejoin")
|
||||
return True
|
||||
|
||||
def _fake_record(**_kwargs):
|
||||
events.append("record")
|
||||
return False
|
||||
|
||||
with patch(
|
||||
"douyin.fudai.core.fudai_filter_pkg.join_decision.should_skip_fudai_by_config",
|
||||
return_value=(True, "countdown_gt_118"),
|
||||
), patch(
|
||||
"douyin.fudai.core.fudai_attend_pkg.fansclub_handler.handle_fansclub_branch",
|
||||
side_effect=_fake_prejoin,
|
||||
) as mock_prejoin, patch(
|
||||
"douyin.reservation.reservation_logic.record.record_high_value_reservation",
|
||||
side_effect=_fake_record,
|
||||
) as mock_record:
|
||||
ok = basic_join_decision(analyser, detail)
|
||||
|
||||
assert ok is True
|
||||
assert events == ["prejoin", "record"]
|
||||
mock_prejoin.assert_called_once_with(analyser, "加入购物粉丝团并关注主播")
|
||||
mock_record.assert_called_once()
|
||||
assert analyser._reservation_prejoined_fansclub is True
|
||||
analyser.swipe_up_to_next_live.assert_called_once()
|
||||
|
||||
|
||||
def test_high_value_countdown_within_join_window_attends():
|
||||
analyser = _mk_analyser()
|
||||
future_ts = time.time() + 30 # <= join_ahead_seconds
|
||||
|
||||
Reference in new issue
Block a user