Fix reservation direct attend timing guard
This commit is contained in:
1 parent
8fac904ba9
commit
b533c4e96e
8 files changed
+609
-22
No files matched your search
@@ -0,0 +1,47 @@
|
||||
from __future__ import annotations
|
||||
|
||||
import time
|
||||
from types import SimpleNamespace
|
||||
from unittest.mock import MagicMock
|
||||
|
||||
|
||||
def test_record_high_value_reservation_preserves_button_fields():
|
||||
from douyin.reservation.reservation_logic.record import record_high_value_reservation
|
||||
|
||||
analyser = SimpleNamespace(
|
||||
_log_kv=MagicMock(return_value=None),
|
||||
_fudai_button_text="一键发表评论",
|
||||
_fudai_button_status="需要评论",
|
||||
)
|
||||
reservations = []
|
||||
|
||||
ok = record_high_value_reservation(
|
||||
analyser=analyser,
|
||||
fudai_content_text="儿童电话手表",
|
||||
prize_value_yuan=899.0,
|
||||
lastsecond=120,
|
||||
future_timestamp=time.time() + 600,
|
||||
x=162,
|
||||
needswitch=True,
|
||||
wait_minutes=0,
|
||||
post_switch_delay_s=0.0,
|
||||
room_pos=1,
|
||||
reservations=reservations,
|
||||
reservation_focus_until_ts_ref=[0.0],
|
||||
close_detail_callback=lambda: None,
|
||||
swipe_up_switch_callback=lambda: None,
|
||||
swipe_down_back_callback=lambda: None,
|
||||
add_reservation_callback=lambda items, item: items.append(item),
|
||||
sort_reservations_callback=lambda: None,
|
||||
write_state_callback=lambda: None,
|
||||
room_title="学而思",
|
||||
room_title_raw="学而思",
|
||||
task_count=2,
|
||||
time_text="10:00",
|
||||
participants=0,
|
||||
copies=1,
|
||||
)
|
||||
|
||||
assert ok is False
|
||||
assert reservations[0]["button_text"] == "一键发表评论"
|
||||
assert reservations[0]["button_status"] == "需要评论"
|
||||
Reference in new issue
Block a user