Consolidate user logins in webapi tests.
Consolidate user logins in webapi tests.

Many webapi tests needed to re-login with specific users, which may be
members of a LocalSite and/or admins.

This adds a _login_user function that takes parameters indicating whether the
user should be part of a local_site and/or whether they should be an admin.
It will determine the right user, potentially add it to the LocalSite's admin
lists, and log in. This reduces the amount of code in the tests and will be
used for the upcoming repository tests, which make extensive use of this.

Reviewed at http://reviews.reviewboard.org/r/2134/

davidt/reviewboard,chazy/reviewboard,chazy/reviewboard,chazy/reviewboard,Khan/reviewboard,Khan/reviewboard,Khan/reviewboard,bkochendorfer/reviewboard,davidt/reviewboard,chipx86/reviewboard,KnowNo/reviewboard,atagar/ReviewBoard,custode/reviewboard,KnowNo/reviewboard,brennie/reviewboard,Khan/reviewboard,davidt/reviewboard,reviewboard/reviewboard,1tush/reviewboard,reviewboard/reviewboard,Khan/reviewboard,sgallagher/reviewboard,beol/reviewboard,1tush/reviewboard,custode/reviewboard,bkochendorfer/reviewboard,beol/reviewboard,atagar/ReviewBoard,Khan/reviewboard,chazy/reviewboard,bkochendorfer/reviewboard,chazy/reviewboard,atagar/ReviewBoard,chipx86/reviewboard,KnowNo/reviewboard,beol/reviewboard,chazy/reviewboard,chazy/reviewboard,atagar/ReviewBoard,custode/reviewboard,1tush/reviewboard,Khan/reviewboard,chipx86/reviewboard,atagar/ReviewBoard,sgallagher/reviewboard,davidt/reviewboard,chazy/reviewboard,chazy/reviewboard,Khan/reviewboard,atagar/ReviewBoard,Khan/reviewboard,1tush/reviewboard,beol/reviewboard,sgallagher/reviewboard,brennie/reviewboard,bkochendorfer/reviewboard,1tush/reviewboard,atagar/ReviewBoard,brennie/reviewboard,1tush/reviewboard,1tush/reviewboard,reviewboard/reviewboard,atagar/ReviewBoard,sgallagher/reviewboard,1tush/reviewboard,atagar/ReviewBoard,KnowNo/reviewboard,custode/reviewboard,reviewboard/reviewboard,1tush/reviewboard,brennie/reviewboard,chipx86/reviewboard