As someone who regularly does Oak Challenges, I can confidently say that Pulse and X are right.
All Pokemon you catch within your save file will obey regardless, but traded Pokemon will not obey if you don't have the gym badge to level requirement
Once you get the gym badge, they will obey until level 20. In the meantime, use a Pokemon you've caught yourself to help beat the gym, eg. your starter