Jesus taught us to pray, 'Lead us not into temptation.' James tells us that God does not tempt anyone. In Potiphar's house Joseph found himself in a horrible lose-lose situation, he had no good options. But Joseph stood strong, he said, 'How can I do this thing and sin against God?'
There is much that we can learn from Joseph, including how to keep opportunity and temptation from meeting and resulting in sin in our lives.