Satan and god make a bet to see if Job will remain faithful even if everything is taken away from him.
Job 1:10-13 says, "Have you not put a hedge around him and his house and all that he has, on every side? You have blessed the work of his hands, and his possessions have increased in the land. But stretch out your hand and touch all that he has, and he will curse you to your face.” And the Lord said to Satan, “Behold, all that he has is in your hand. Only against him do not stretch out your hand.” So Satan went out from the presence of the Lord."
Later god permits satan to harm Job.
Job 2:4-8 says, " Then Satan answered the Lord and said, “Skin for skin! All that a man has he will give for his life. But stretch out your hand and touch his bone and his flesh, and he will curse you to your face.” And the Lord said to Satan, “Behold, he is in your hand; only spare his life.”
So Satan went out from the presence of the Lord and struck Job with loathsome sores from the sole of his foot to the crown of his head. And he took a piece of broken pottery with which to scrape himself while he sat in the ashes."
So yes, god made a bet with satan and allowed an innocent man to be tortured.