test ajax fail and refactor mock api responses to test utils module