Germans had already surrendered and the Japanese were going to surrender as Russians now were able to move their force against Japan before the nuclear bombs were used. They were used to test the bombs and make sure no such war happens again specially the 2nd Bomb on Nagasaki that was used a few days after they bombed Hiroshima.
> They were used to test the bombs and make sure no such war happens again
The two cities were already on a "to be bombed" list and were the 73rd and 74th Japanese cities to be utterly destroyed by bombing.
So, Yes - they were literally used to test the bombs.
The "and make sure no such war happens again" is more of a post WWII retcon of the Cold War era.