Exemplo n.º 1
0
    def test_backqueued_postings(self):
        state_storage.set('stardate.handlers', 'spock@localhost', 'LOG')
        reminder_storage.set('spock@localhost', datetime.date.today() - datetime.timedelta(days=5))

        engage()
        assert delivered("Captain's Log"), "No reminder log delivered."
        assert queue().count() == 5, "%u backqueued reminders were delivered?" % queue().count()
Exemplo n.º 2
0
    def test_rejects_unexpected_logs(self):
        """Rejects unexpected logs."""

        self.confirm_subscription()

        client.say("1900.01.01-abc123@localhost", "Unexpected logs should be dropped.")
        assert queue().count() == 0, "Accepting unexpected logs?!"
Exemplo n.º 3
0
    def test_no_double_opening_posting(self):
        state_storage.set('stardate.handlers', 'spock@localhost', 'LOG')

        engage()
        clear_queue()

        engage()
        assert queue().count() == 0, "Delivered a duplicate reminder after promotion."
Exemplo n.º 4
0
def test_inertial_dampener():
    reminder_storage.clear()
    state_storage.clear()

    client.begin()

    engage()
    assert queue().count() == 0, "Reminding when there's no one to remind?"
Exemplo n.º 5
0
    def test_rejects_unauthorized_confirms(self):
        """Reject unauthorized confirmation messages."""

        c = client.say("punchit@localhost", "First message!",
                       expect="punchit-confirm-[a-z0-9]+@localhost")
        clear_queue()

        client.say("punchit-confirm-abc123@localhost", "Let's go!")
        assert queue().count() == 0, "Accepting unauthorized confirmation messages?!"
Exemplo n.º 6
0
    def test_no_double_backqueued_postings(self):
        state_storage.set('stardate.handlers', 'spock@localhost', 'LOG')
        reminder_storage.set('spock@localhost', datetime.date.today() - datetime.timedelta(days=5))

        engage()
        clear_queue()

        engage()
        assert queue().count() == 0, "Delivered a duplicate reminder after the backqueue."
Exemplo n.º 7
0
    def test_rejects_unauthorized_logs(self):
        """Reject unauthorized logs."""

        client.say("1900.01.01-abc123@localhost", "Unauthorized logs should be dropped.")
        assert queue().count() == 0, "Accepting unauthorized logs?!"
Exemplo n.º 8
0
    def test_rejects_unexpected_confirms(self):
        """Reject unexpected confirmation messages."""

        client.say("punchit-confirm-abc123@localhost", "Unexpected confirmations should be dropped.")
        assert queue().count() == 0, "Accepting unexpected confirmation messages?!"
Exemplo n.º 9
0
    def test_rejects_unexpected(self):
        """Reject unexpected messages."""

        client.say("random@localhost", "Unexpected messages should be dropped.")
        assert queue().count() == 0, "Responding to unexpected messages?!"