feat(пополнение): тревога, когда платёжка трижды подряд не создала платёж
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -441,3 +441,19 @@ def test_person_block_and_status_view(env, monkeypatch):
|
||||
assert topup.status_for_person(USER, 99999) is None
|
||||
monkeypatch.setenv("TOPUP_ENABLED", "0")
|
||||
assert topup.person_block(USER) is None
|
||||
|
||||
|
||||
def test_provider_down_three_times_in_a_row_alerts(env, monkeypatch):
|
||||
"""Платёжка не создала платёж три раза подряд — тревога один раз на серию; два сбоя —
|
||||
тишина. Порча: тревога на каждом сбое или никогда."""
|
||||
db, topup, balance, prov, sent = env
|
||||
monkeypatch.setattr(topup, "MAX_OPEN_PER_HOUR", 99)
|
||||
prov.fail_create = True
|
||||
for _ in range(2):
|
||||
with pytest.raises(topup.TopupError):
|
||||
_start(topup)
|
||||
assert not any("подряд" in t for t in sent)
|
||||
for _ in range(2):
|
||||
with pytest.raises(topup.TopupError):
|
||||
_start(topup)
|
||||
assert sum("подряд" in t for t in sent) == 1
|
||||
|
||||
Reference in New Issue
Block a user