fix(douyu): 按到期时间修正精英宝典状态
This commit is contained in:
@@ -2069,6 +2069,38 @@ class TestBindingAndCompletion(_Base):
|
||||
assert detail["task"]["exchangeStatus"] == "points_short"
|
||||
assert detail["task"]["account"]["id"] == account.id
|
||||
|
||||
def test_expired_elite_is_not_currently_opened(self, monkeypatch):
|
||||
task = self._allocated()
|
||||
account = (
|
||||
self.session.query(Account).filter(Account.id == task.account_id).one()
|
||||
)
|
||||
task.binding_status = "bound"
|
||||
task.execution_status = "bound"
|
||||
self.session.commit()
|
||||
monkeypatch.setattr(
|
||||
service,
|
||||
"query_exchange_eligibility",
|
||||
lambda *_args, **_kwargs: DouyuEligibilityResult(
|
||||
elite_user_info={"manual_type": 1, "expire_time": 1},
|
||||
points=2000,
|
||||
points_response={"points": 2000},
|
||||
limited_goods=[],
|
||||
limited_ids=frozenset(),
|
||||
),
|
||||
)
|
||||
|
||||
detail = service.refresh_exchange_eligibility(
|
||||
self.session,
|
||||
task_id=task.id,
|
||||
current=self.admin,
|
||||
)
|
||||
|
||||
self.session.refresh(account)
|
||||
assert account.elite_opened is False
|
||||
assert account.elite_expire_time == 1
|
||||
assert detail["task"]["exchangeStatus"] == "not_opened"
|
||||
assert detail["task"]["issueCode"] == "elite_not_opened"
|
||||
|
||||
def test_expired_lease_moves_unfinished_task_to_manual(self):
|
||||
task = self._allocated()
|
||||
lease = self.session.query(AccountLease).one()
|
||||
|
||||
Reference in New Issue
Block a user