Add unit test for auth code flow