Ejemplo 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'
Ejemplo 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)
Ejemplo 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'
Ejemplo 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)
Ejemplo 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'")
Ejemplo 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'")