Fix unit tests with the latest LocalSiteProfile counter changes.

Review Request #6924 — Created Feb. 8, 2015 and submitted

Information

Review Board
release-2.0.x
6d794b5...

Reviewers

The recent changes to show the LocalSiteProfile models inline in the
User admin UI page broke unit tests, due to a bad assumption in the new
conditionals that the queries should return 0 if the LocalSiteProfile
hasn't yet been saved.

This situation is actually valid, because the related objects being
counted are based off the User, not the LocalSiteProfile. So, instead,
we need to have the conditionals check into the associated user ID.

This fixes all unit tests, and the original failure case of viewing the
User admin page.

Unit tests pass.

I could use the User pages without any errors.

reviewbot
  1. Tool: PEP8 Style Checker
    Processed Files:
        reviewboard/accounts/models.py
    
    
    
    Tool: Pyflakes
    Processed Files:
        reviewboard/accounts/models.py
    
    
  2. 
      
david
  1. Ship It!
  2. 
      
chipx86
Review request changed
Status:
Completed
Change Summary:
Pushed to release-2.0.x (f8842c7)