Is God testing you or are you being tempted by the enemy?
To be clear, God doesn't tempt us. He tests us. (James 1:13)
Even the right thing in the wrong season is disobeying God. Sometimes the enemy will tempt us with the right thing, but it's not God's perfect timing yet.
We become tempted when we are drawn away by our desires and enticed.
The lust of the flesh, the lust of the eyes, and the pride of life are what tempts us (1 John 2:15).
God will sometimes test us to humble us and expose what's in our hearts. (Deuteronomy 8:2)
God tests us to increase our faith in Him. God wants us to rely not on our own understanding, but to fully trust Him with all things.
We need to renew our minds and cleanse our hearts to discern God's will.