Fix account page tests.

The addition of the API tokens page for the user account preferences caused
some test breakages. I've fixed them, and also centralized the code a bit so
there are fewer changes to make when we change the structure of the pages.

Testing done: Ran unit tests.

Reviewed at https://reviews.reviewboard.org/r/6211/