def test_quote_suffix(self): dbPath = os.path.join(testPath, '__test_bot_quote_suffix.sqlite') self._delete(dbPath) settings = Settings() settings.QUOTE_AUTO_SUFFIX = True now = datetime.now() expected_suffix = " - {streamer} @ {year}-{month:02}-{day:02}".format( streamer=settings.CHANNEL_LIST["#tmp"], year=int(now.strftime("%Y")), month=int(now.strftime("%m")), day=int(now.strftime("%d"))) bot = Bot(settings, None, FakeWrapper, logger=nullLogger, wrap_irc=False) bot._initialize_models() bot._add_quote("#tmp", "foobar", ["test"], timestamp=now) quote_id, quote = bot._get_model("#tmp", "quotes").get_random_quote() expected = "test" + expected_suffix assert quote == expected
def test__add_quote(self): dbPath = os.path.join(testPath, '__test_bot_add_quote.sqlite') self._delete(dbPath) settings = Settings() settings.DATABASE_PATH = dbPath bot = Bot(settings, None, FakeWrapper, logger=nullLogger, wrap_irc=False) bot._initialize_models() bot._add_quote("#tmp", "foobar", ["test"]) quote_id, quote = bot._get_model("#tmp", "quotes").get_random_quote() assert str(quote) == "test"
def test_quote_suffix(self): dbPath = os.path.join(testPath, '__test_bot_quote_suffix.sqlite') self._delete(dbPath) settings = Settings() settings.QUOTE_AUTO_SUFFIX = True now = datetime.now() expected_suffix = " - {streamer} @ {year}-{month:02}-{day:02}".format( streamer=settings.CHANNEL_LIST["#tmp"], year=int(now.strftime("%Y")), month=int(now.strftime("%m")), day=int(now.strftime("%d")) ) bot = Bot(settings, None, FakeWrapper, logger=nullLogger, wrap_irc=False) bot._initialize_models() bot._add_quote("#tmp", "foobar", ["test"], timestamp=now) quote_id, quote = bot._get_model("#tmp", "quotes").get_random_quote() expected = "test" + expected_suffix assert quote == expected