Add unit tests for HostingServiceAccountResource.

Review Request #5891 — Created May 28, 2014 and submitted

Information

Review Board
master
4145eb9...

Reviewers

This resource never had any accompanying tests when it was first
written. As we made changes to the resource or any other backing
services, we had no way of verifying that the code worked through the
API. It turns out, it didn't, as POSTing ended up calling save() on the
wrong object.

This introduces a basic test suite for this resource.

Unit tests passed.

Description From Last Updated

local variable 'repository' is assigned to but never used

reviewbotreviewbot

I'd prefer to flip these and test if it's HostingServiceAccount, and then use .pk there. It might also be useful …

daviddavid
reviewbot
  1. This is a review from Review Bot.
      Tool: PEP8 Style Checker
      Processed Files:
        reviewboard/webapi/resources/hosting_service_account.py
        reviewboard/webapi/tests/mixins.py
        reviewboard/webapi/tests/urls.py
        reviewboard/webapi/tests/mimetypes.py
        reviewboard/webapi/tests/test_hosting_service_account.py
      Ignored Files:
    
    
  2. 
      
reviewbot
  1. This is a review from Review Bot.
      Tool: Pyflakes
      Processed Files:
        reviewboard/webapi/resources/hosting_service_account.py
        reviewboard/webapi/tests/mixins.py
        reviewboard/webapi/tests/urls.py
        reviewboard/webapi/tests/mimetypes.py
        reviewboard/webapi/tests/test_hosting_service_account.py
      Ignored Files:
    
    
  2. Show all issues
     local variable 'repository' is assigned to but never used
    
  3. 
      
chipx86
reviewbot
  1. This is a review from Review Bot.
      Tool: PEP8 Style Checker
      Processed Files:
        reviewboard/webapi/resources/hosting_service_account.py
        reviewboard/webapi/tests/mixins.py
        reviewboard/webapi/tests/urls.py
        reviewboard/webapi/tests/mimetypes.py
        reviewboard/webapi/tests/test_hosting_service_account.py
      Ignored Files:
    
    
  2. 
      
reviewbot
  1. This is a review from Review Bot.
      Tool: Pyflakes
      Processed Files:
        reviewboard/webapi/resources/hosting_service_account.py
        reviewboard/webapi/tests/mixins.py
        reviewboard/webapi/tests/urls.py
        reviewboard/webapi/tests/mimetypes.py
        reviewboard/webapi/tests/test_hosting_service_account.py
      Ignored Files:
    
    
  2. 
      
david
  1. 
      
  2. reviewboard/webapi/tests/urls.py (Diff revision 2)
     
     
    Show all issues

    I'd prefer to flip these and test if it's HostingServiceAccount, and then use .pk there.

    It might also be useful to test for int, and if it's neither, raise a ValueError.

    1. This is what the other test URL functions are doing, so it's probably best to fix them all in one go if we really want to tighten this down.

      I don't mind changing it to raise a ValueError, but if something other than an int results from this, the URL lookup will fail with the repr of the resulting value, which is helpful enough.

    2. I'll do a follow-up change to this that fixes this all up, including this statement.

  3. 
      
chipx86
reviewbot
  1. This is a review from Review Bot.
      Tool: PEP8 Style Checker
      Processed Files:
        reviewboard/webapi/resources/hosting_service_account.py
        reviewboard/webapi/tests/mixins.py
        reviewboard/webapi/tests/urls.py
        reviewboard/webapi/tests/mimetypes.py
        reviewboard/webapi/tests/test_hosting_service_account.py
      Ignored Files:
    
    
  2. 
      
reviewbot
  1. This is a review from Review Bot.
      Tool: Pyflakes
      Processed Files:
        reviewboard/webapi/resources/hosting_service_account.py
        reviewboard/webapi/tests/mixins.py
        reviewboard/webapi/tests/urls.py
        reviewboard/webapi/tests/mimetypes.py
        reviewboard/webapi/tests/test_hosting_service_account.py
      Ignored Files:
    
    
  2. 
      
david
  1. Ship It!

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