Refs #2908, refactored tests so database setup (adding sites, tracking visits) are separated from API tests. Put setup code into fixtures and reused code as much as possible.