How One tests God ? – The Hebrew writer quoted the psalmist: “Today if you hear His voice, do not harden your hearts as when they provoked Me…where your fathers tried Me by testing Me, and saw My works for forty years. Therefore I was angry with this generation, and said, ‘They always go astray in their heart, and they did not know My ways’” (Hebrews 3:7-10). In straying from God, the Israelites were guilty of sinning and being disobedient (Hebrews 3:17-18). Such disobedience was directly tied to their unbelief (Hebrews 3:19). James explained the reason for this connection: “Faith without works is dead” (James 2:26). When one does not obey God, he is guilty of testing God.
1 Peter 2:11-17 (MKJV) Dearly beloved, I exhort you as temporary residents and pilgrims to abstain from fleshly lusts which war against the soul,  having your conduct honest among the nations, in that which they speak against you as evildoers, they may glorify God in a day of His visitation, seeing your good works.  Then be in obedience to every ordinance of men, because of the Lord, whether to a king as supreme,  or to governors as sent by Him for vengeance on evildoers, but for praise on well-doers.  For such is the will of God, doing good to silence the ignorance of foolish men;  as free, and not having freedom as a cover of evil, but as servants of God.  Honor all. Love the brotherhood. Fear God. Honor the king.
Romans 13:1-7 (MKJV) Let every soul be subject to the higher authorities. For there is no authority but of God; the authorities that exist are ordained by God.  So that the one resisting the authority resists the ordinance of God; and the ones who resist will receive judgment to themselves.  For the rulers are not a terror to good works, but to the bad. And do you desire to be not afraid of the authority? Do the good, and you shall have praise from it.  For it is a servant of God to you for good. For if you practice evil, be afraid, for it does not bear the sword in vain; for it is a servant of God, a revenger for wrath on him who does evil.  Therefore you must be subject, not only for wrath, but also for conscience' sake.  For because of this you also pay taxes. For they are God's servants, always giving attention to this very thing.  Therefore give to all their dues; to the one due tax, the tax; tribute to whom tribute is due , fear to whom fear is due , and honor to whom honor is due .