Ejemplo n.º 1
0
def tweet(response, dry_run=True):
    bot = JLPTBot()
    msg = bot.format(bot.get_date_based_word())
    if not dry_run:
        bot.tweet(msg)
    response.headers['Content-Type'] = 'text/plain'
    response.write(msg)
Ejemplo n.º 2
0
def tweet(response, dry_run=True):
    bot = JLPTBot()
    msg = bot.format(bot.get_date_based_word())
    if not dry_run:
        bot.tweet(msg)
    response.headers['Content-Type'] = 'text/plain'
    response.write(msg)
Ejemplo n.º 3
0
    def test_returns_word_based_on_date(self):
        bot = JLPTBot()

        now = datetime.utcnow()
        baseline_time = datetime(2013, 12, 1, 0, 0, 0)
        days_since = (now - baseline_time).days
        expected = bot.words[days_since]

        actual = bot.get_date_based_word()
        self.assertEqual(actual, expected)
Ejemplo n.º 4
0
    def test_returns_word_based_on_date(self):
        bot = JLPTBot()

        now = datetime.utcnow()
        baseline_time = datetime(2013, 12, 1, 0, 0, 0)
        days_since = (now - baseline_time).days
        expected = bot.words[days_since]

        actual = bot.get_date_based_word()
        self.assertEqual(actual, expected)
Ejemplo n.º 5
0
    def test_index_is_mod_word_list_length(self):
        bot = JLPTBot()

        expected = bot.words[200]
        actual = bot.get_date_based_word(index_override=len(bot.words) + 200)
        self.assertEqual(actual, expected)
Ejemplo n.º 6
0
    def test_index_is_mod_word_list_length(self):
        bot = JLPTBot()

        expected = bot.words[200]
        actual = bot.get_date_based_word(index_override=len(bot.words) + 200)
        self.assertEqual(actual, expected)