def test_blocked_command(): with pytest.raises(RedisClusterException) as ex: blocked_command(None, "SET") assert unicode(ex.value) == "Command: SET is blocked in redis cluster mode"