Esempio n. 1
0
    def test_in_reminder_for_different_channel(self, reactor, db):
        db.reminders.insert.return_value = 1

        with freeze_time(self.now):
            reminders.in_reminder(self.client, '#bots', 'me',
                                  ['12m', 'on', '#foo', 'this', 'is', 'the', 'message'])

        inserted = db.reminders.insert.call_args[0][0]
        assert inserted['channel'] == '#foo'
        assert inserted['message'] == 'this is the message'
Esempio n. 2
0
    def test_in_reminder_for_days(self, reactor, db):
        db.reminders.insert.return_value = 1

        with freeze_time(self.now):
            reminders.in_reminder(self.client, '#bots', 'me', ['12d', 'this', 'is', 'the', 'message'])

        inserted = db.reminders.insert.call_args[0][0]

        assert inserted['message'] == 'this is the message'
        assert inserted['channel'] == '#bots'
        assert reactor.callLater.call_args[0] == (12 * 24 * 3600, reminders._do_reminder, 1, self.client)
Esempio n. 3
0
    def test_in_reminder_for_different_channel(self, reactor, db):
        db.reminders.insert.return_value = 1

        with freeze_time(self.now):
            reminders.in_reminder(
                self.client, '#bots', 'me',
                ['12m', 'on', '#foo', 'this', 'is', 'the', 'message'])

        inserted = db.reminders.insert.call_args[0][0]
        assert inserted['channel'] == '#foo'
        assert inserted['message'] == 'this is the message'
Esempio n. 4
0
    def test_in_reminder_for_days(self, reactor, db):
        db.reminders.insert.return_value = 1

        with freeze_time(self.now):
            reminders.in_reminder(self.client, '#bots', 'me',
                                  ['12d', 'this', 'is', 'the', 'message'])

        inserted = db.reminders.insert.call_args[0][0]

        assert inserted['message'] == 'this is the message'
        assert inserted['channel'] == '#bots'
        assert reactor.callLater.call_args[0] == (12 * 24 * 3600,
                                                  reminders._do_reminder, 1,
                                                  self.client)
Esempio n. 5
0
 def test_in_reminder_for_unknown(self):
     resp = reminders.in_reminder(self.client, '#bots', 'me', ['12x', 'this', 'is', 'the', 'message'])
     assert resp.startswith("Sorry I didn't understand '12x'")
Esempio n. 6
0
 def test_in_reminder_for_unknown(self):
     resp = reminders.in_reminder(self.client, '#bots', 'me',
                                  ['12x', 'this', 'is', 'the', 'message'])
     assert resp.startswith("Sorry I didn't understand '12x'")