discord_checkin_bot/test_counter_bot.py

18 lines
510 B
Python
Raw Normal View History

2021-12-28 17:03:50 +01:00
import sqlite3
from .counter_bot import CounterBot
TEST_DB_NAME = "test.db"
counter_bot = CounterBot(TEST_DB_NAME)
counter_bot.clear_rows()
def test_get_present_count() -> None:
counter_bot.update_presence("Alice", True)
counter_bot.update_presence("Bob", True)
counter_bot.update_presence("Bob", False)
counter_bot.update_presence("Bob", True)
assert counter_bot.get_present_count() == 2
def test_present_names() -> None:
assert counter_bot.get_present_names() == ["Alice", "Bob"]