Make the ID checks more restrict in the webapi test URL functions.

Review Request #5898 — Created May 29, 2014 and submitted

Information

Review Board
master
779dee7...

Reviewers

This enhances the logic of the various get_*_url() functions to be more
strict when they're willing to accept either an ID or an object.

A new function, _normalize_id(), checks if the value is an ID or an
instance (or subclass) of the allowed class type. If it's not any of
these things, then a ValueError will be raised.

This reduces the complexity of the code in the functions, prevents
duplication, and adds enhanced error checking.

Unit tests pass.

Description From Last Updated

'HostingServiceAccount' imported but unused

reviewbotreviewbot
reviewbot
  1. This is a review from Review Bot.
      Tool: PEP8 Style Checker
      Processed Files:
        reviewboard/webapi/tests/urls.py
      Ignored Files:
    
    
  2. 
      
reviewbot
  1. This is a review from Review Bot.
      Tool: Pyflakes
      Processed Files:
        reviewboard/webapi/tests/urls.py
      Ignored Files:
    
    
  2. reviewboard/webapi/tests/urls.py (Diff revision 1)
     
     
    Show all issues
     'HostingServiceAccount' imported but unused
    
  3. 
      
chipx86
reviewbot
  1. This is a review from Review Bot.
      Tool: PEP8 Style Checker
      Processed Files:
        reviewboard/webapi/tests/urls.py
      Ignored Files:
    
    
  2. 
      
reviewbot
  1. This is a review from Review Bot.
      Tool: Pyflakes
      Processed Files:
        reviewboard/webapi/tests/urls.py
      Ignored Files:
    
    
  2. 
      
david
  1. Ship It!

  2. 
      
chipx86
Review request changed
Status:
Completed
Change Summary:
Pushed to master (c79bb53)