Our congress has to approve flag officers. However there "were" brevet ranks which are not permanent. So yes they are political appointments to an extent, however latent abilities play the biggest part. King was an ass but he knew how to divert resources to the Pacific and launched a counter offensive when the rest of the allies were stuck on "Europe first". Patton was a great battlefield commander, however I wouldn't stick him in running a theater command. Halsey and Fletcher might not be able to run a theater but Nimitz could. The sub commander also is a great choice but I cannot remember his namwe.
Look at Eisenhower. He not good at strategy but had great relationship with the British and was a great organizer.