mirror of
https://github.com/kuhyx/signal-bot.git
synced 2026-11-28 19:19:06 +01:00
Compare commits
No commits in common. "180e53210b506856509f8203c7f9e8d5e6e76e1a" and "1aa5b5a7a4514a3e6604a9d71b001f5877b77555" have entirely different histories.
180e53210b
...
1aa5b5a7a4
@ -2,7 +2,7 @@
|
||||
"""Reusable gates that wrap a command handler.
|
||||
|
||||
These are the mechanisms salvaged from the unmerged vote and rate-limit
|
||||
branches, detached from the command they were originally written for.
|
||||
branches, detached from the NSFW command they were originally written for.
|
||||
They only decide whether a handler may run; recording a successful use is the
|
||||
dispatcher's job, so stacking two gates cannot double-count one invocation.
|
||||
"""
|
||||
|
||||
@ -74,10 +74,10 @@ def test_uses_today_is_per_user_and_command(store: Store) -> None:
|
||||
|
||||
|
||||
def test_votes_are_deduplicated_per_person(store: Store) -> None:
|
||||
store.add_vote(GROUP, "kot", "u1", 100.0)
|
||||
store.add_vote(GROUP, "kot", "u1", 101.0)
|
||||
store.add_vote(GROUP, "kot", "u2", 102.0)
|
||||
assert store.count_votes(GROUP, "kot", 0.0) == 2
|
||||
store.add_vote(GROUP, "traps", "u1", 100.0)
|
||||
store.add_vote(GROUP, "traps", "u1", 101.0)
|
||||
store.add_vote(GROUP, "traps", "u2", 102.0)
|
||||
assert store.count_votes(GROUP, "traps", 0.0) == 2
|
||||
|
||||
|
||||
def test_votes_outside_the_window_are_ignored(store: Store) -> None:
|
||||
|
||||
Loading…
Reference in New Issue
Block a user