refactor tests and fix OAuth tests
Merge remote-tracking branch 'origin/master'