Example #1
0
    def test_incorrect_item(self):
        """Blacklisted commands should not be allowed (string blacklist)."""
        message = ReceivedMessage(b'WRONG_COMMAND\r\n')
        wrapped = filters.deny('WRONG_COMMAND')(self.handler)

        wrapped(self.client, message)

        self.assertFalse(self.handler.called)
Example #2
0
    def test_correct_item(self):
        """Un-blacklisted commands should be allowed (string blacklist)."""
        message = ReceivedMessage(b'COMMAND\r\n')
        wrapped = filters.deny('WRONG_COMMAND')(self.handler)

        wrapped(self.client, message)

        self.handler.assert_called_once_with(
            client=self.client,
            message=message,
        )