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()
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?!"
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."
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?"
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?!"
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."
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?!"
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?!"
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?!"