Add an API resource for hosting services.

Review Request #5882 — Created May 26, 2014 and submitted

Information

Review Board
master
b163f12...

Reviewers

This introduces /api/hosting-services/, which provides basic information
on the hosting services supported by Review Board.

The resource does not expose all the information on a HostingService.
Right now, I'm keeping to the basic information, such as the name and
capabilities, until I determine what we're going to want to use for the
new repository configuration UI. This UI may impact how HostingService
itself structures data down the road, so it's not worth baking anything
related to that into the API yet.

This work is loosely based on Olessia's UCOSP work, though many
changes were made to better fit in with other resources, to take
advantage of what WebAPIResource provides, and to make use of the new
LocalDataQuerySet (which greatly reduces the amount of code).

Fetched the list resource and compared the output to the values from
the HostingServices.

Followed links to the item resources. Saw those being fetched as well,
with the correct data.

Tested that things like pagination worked (had to limit the number of
results for this).

Unit tests passed.

Description From Last Updated

'webapi_response_errors' imported but unused

reviewbotreviewbot

'webapi_request_fields' imported but unused

reviewbotreviewbot

'webapi_login_required' imported but unused

reviewbotreviewbot

'PERMISSION_DENIED' imported but unused

reviewbotreviewbot

'DOES_NOT_EXIST' imported but unused

reviewbotreviewbot

'NOT_LOGGED_IN' imported but unused

reviewbotreviewbot

'get_hosting_service' imported but unused

reviewbotreviewbot

'webapi_check_login_required' imported but unused

reviewbotreviewbot

'webapi_check_local_site' imported but unused

reviewbotreviewbot

Hmm. Can we clarify this somehow? "Whether creating review requests for committed changes is supported through the web UI?"

daviddavid
reviewbot
  1. This is a review from Review Bot.
      Tool: PEP8 Style Checker
      Processed Files:
        reviewboard/webapi/tests/test_hosting_service.py
        reviewboard/webapi/resources/root.py
        reviewboard/webapi/tests/urls.py
        reviewboard/webapi/resources/hosting_service.py
        reviewboard/webapi/tests/mimetypes.py
      Ignored Files:
        docs/manual/webapi/2.0/resources/hosting-service-list.rst
        docs/manual/webapi/2.0/resources/hosting-service.rst
        docs/manual/webapi/2.0/resources/index.rst
    
    
  2. 
      
reviewbot
  1. This is a review from Review Bot.
      Tool: Pyflakes
      Processed Files:
        reviewboard/webapi/tests/test_hosting_service.py
        reviewboard/webapi/resources/root.py
        reviewboard/webapi/tests/urls.py
        reviewboard/webapi/resources/hosting_service.py
        reviewboard/webapi/tests/mimetypes.py
      Ignored Files:
        docs/manual/webapi/2.0/resources/hosting-service-list.rst
        docs/manual/webapi/2.0/resources/hosting-service.rst
        docs/manual/webapi/2.0/resources/index.rst
    
    
  2. Show all issues
     'webapi_response_errors' imported but unused
    
  3. Show all issues
     'webapi_request_fields' imported but unused
    
  4. Show all issues
     'webapi_login_required' imported but unused
    
  5. Show all issues
     'PERMISSION_DENIED' imported but unused
    
  6. Show all issues
     'DOES_NOT_EXIST' imported but unused
    
  7. Show all issues
     'NOT_LOGGED_IN' imported but unused
    
  8. Show all issues
     'get_hosting_service' imported but unused
    
  9. Show all issues
     'webapi_check_login_required' imported but unused
    
  10. Show all issues
     'webapi_check_local_site' imported but unused
    
  11. 
      
chipx86
reviewbot
  1. This is a review from Review Bot.
      Tool: PEP8 Style Checker
      Processed Files:
        reviewboard/webapi/tests/test_hosting_service.py
        reviewboard/webapi/resources/root.py
        reviewboard/webapi/tests/urls.py
        reviewboard/webapi/resources/hosting_service.py
        reviewboard/webapi/tests/mimetypes.py
      Ignored Files:
        docs/manual/webapi/2.0/resources/hosting-service-list.rst
        docs/manual/webapi/2.0/resources/hosting-service.rst
        docs/manual/webapi/2.0/resources/index.rst
    
    
  2. 
      
reviewbot
  1. This is a review from Review Bot.
      Tool: Pyflakes
      Processed Files:
        reviewboard/webapi/tests/test_hosting_service.py
        reviewboard/webapi/resources/root.py
        reviewboard/webapi/tests/urls.py
        reviewboard/webapi/resources/hosting_service.py
        reviewboard/webapi/tests/mimetypes.py
      Ignored Files:
        docs/manual/webapi/2.0/resources/hosting-service-list.rst
        docs/manual/webapi/2.0/resources/hosting-service.rst
        docs/manual/webapi/2.0/resources/index.rst
    
    
  2. 
      
david
  1. 
      
  2. Show all issues

    Hmm. Can we clarify this somehow? "Whether creating review requests for committed changes is supported through the web UI?"

  3. 
      
chipx86
reviewbot
  1. This is a review from Review Bot.
      Tool: PEP8 Style Checker
      Processed Files:
        reviewboard/webapi/tests/test_hosting_service.py
        reviewboard/webapi/resources/root.py
        reviewboard/webapi/tests/urls.py
        reviewboard/webapi/resources/hosting_service.py
        reviewboard/webapi/tests/mimetypes.py
      Ignored Files:
        docs/manual/webapi/2.0/resources/hosting-service-list.rst
        docs/manual/webapi/2.0/resources/hosting-service.rst
        docs/manual/webapi/2.0/resources/index.rst
    
    
  2. 
      
reviewbot
  1. This is a review from Review Bot.
      Tool: Pyflakes
      Processed Files:
        reviewboard/webapi/tests/test_hosting_service.py
        reviewboard/webapi/resources/root.py
        reviewboard/webapi/tests/urls.py
        reviewboard/webapi/resources/hosting_service.py
        reviewboard/webapi/tests/mimetypes.py
      Ignored Files:
        docs/manual/webapi/2.0/resources/hosting-service-list.rst
        docs/manual/webapi/2.0/resources/hosting-service.rst
        docs/manual/webapi/2.0/resources/index.rst
    
    
  2. 
      
david
  1. 
      
  2. reviewboard/webapi/resources/hosting_service.py (Diff revisions 2 - 3)
     
     
     

    This is still not great, since rbtools can "post an existing commit through the API". That said, I'm struggling to come up with anything better, and I doubt anyone will actually use this anyway.

    1. True. Maybe it's worth nuking that capability and add some more fine-grained ones for things like commit lookup, branch lookup, etc. That could be more useful and descriptive.

      I can remove it from the API for now.

  3. 
      
chipx86
reviewbot
  1. This is a review from Review Bot.
      Tool: PEP8 Style Checker
      Processed Files:
        reviewboard/webapi/tests/test_hosting_service.py
        reviewboard/webapi/resources/root.py
        reviewboard/webapi/tests/urls.py
        reviewboard/webapi/resources/hosting_service.py
        reviewboard/webapi/tests/mimetypes.py
      Ignored Files:
        docs/manual/webapi/2.0/resources/hosting-service-list.rst
        docs/manual/webapi/2.0/resources/hosting-service.rst
        docs/manual/webapi/2.0/resources/index.rst
    
    
  2. 
      
reviewbot
  1. This is a review from Review Bot.
      Tool: Pyflakes
      Processed Files:
        reviewboard/webapi/tests/test_hosting_service.py
        reviewboard/webapi/resources/root.py
        reviewboard/webapi/tests/urls.py
        reviewboard/webapi/resources/hosting_service.py
        reviewboard/webapi/tests/mimetypes.py
      Ignored Files:
        docs/manual/webapi/2.0/resources/hosting-service-list.rst
        docs/manual/webapi/2.0/resources/hosting-service.rst
        docs/manual/webapi/2.0/resources/index.rst
    
    
  2. 
      
david
  1. Ship It!

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