Centralize webapi tests' mimetypes and URL lookups.

Review Request #4522 — Created Sept. 2, 2013 and submitted

Information

Review Board
master

Reviewers

Centralize webapi tests' mimetypes and URL lookups.

The work to split up the webapi test suite had an issue where unit test
classes were being executed multiple times in a test suite run. This
happened because test*.py files were importing classes from other
test*.py files, and nose was finding them. These needed to be imported
in order to get the mimetypes and URLs from those test classes.

This change solves this problem by introducing webapi/tests/mimetypes.py
and webapi/tests/urls.py. mimetypes.py contains the full list of all
expected mimetypes found throughout the test suite. urls.py contains
functions for fetching all the URLs for all resources.

As an aid to urls.py, WebAPIResource now includes functions for
computing the URLs. The ones in urls.py just wrap them to make the
lookups more convenient for the purpose of tests.

Unit tests pass.

Description From Last Updated

If you put the ( on the first line, you can skip the \

daviddavid

Same here.

daviddavid

Can you put two lines in between each group?

daviddavid

Same comment with ( and \

daviddavid

Col: 51 E127 continuation line over-indented for visual indent

reviewbotreviewbot

And here.

daviddavid

And here.

daviddavid

And here

daviddavid

This doesn't need ()

daviddavid

Move the (

daviddavid

No ()

daviddavid

Move the (

daviddavid

Move (

daviddavid

Move (

daviddavid

Move (

daviddavid
reviewbot
  1. This is a review from Review Bot.
    Tool: PEP8 Style Checker
    Processed Files:
    reviewboard/webapi/tests/test_review_reply_screenshot_comment.py
    reviewboard/webapi/tests/test_review_screenshot_comment.py
    reviewboard/webapi/tests/test_file_diff_comment.py
    reviewboard/webapi/tests/test_watched_review_request.py
    reviewboard/webapi/tests/test_review.py
    reviewboard/webapi/tests/test_default_reviewer.py
    reviewboard/webapi/tests/test_draft_review_screenshot_comment.py
    reviewboard/webapi/tests/test_screenshot.py
    reviewboard/webapi/tests/test_repository_commits.py
    reviewboard/webapi/tests/test_review_comment.py
    reviewboard/webapi/tests/test_review_group.py
    reviewboard/webapi/tests/test_file_attachment_draft.py
    reviewboard/webapi/tests/test_change.py
    reviewboard/webapi/tests/test_review_reply.py
    reviewboard/webapi/tests/test_file_attachment_comment.py
    reviewboard/webapi/tests/urls.py
    reviewboard/webapi/tests/test_server_info.py
    reviewboard/webapi/tests/test_repository_branches.py
    reviewboard/webapi/tests/test_user.py
    reviewboard/webapi/tests/base.py
    reviewboard/webapi/tests/test_review_reply_file_attachment_comment.py
    reviewboard/webapi/tests/test_screenshot_comment.py
    reviewboard/webapi/tests/test_session.py
    reviewboard/webapi/tests/test_watched_review_group.py
    reviewboard/webapi/tests/test_review_request.py
    reviewboard/webapi/tests/test_review_request_draft.py
    reviewboard/webapi/tests/test_draft_review_file_attachment_comment.py
    reviewboard/webapi/base.py
    reviewboard/webapi/resources.py
    reviewboard/webapi/tests/test_diff.py
    reviewboard/webapi/tests/test_repository.py
    reviewboard/webapi/tests/test_validate_diff.py
    reviewboard/webapi/tests/test_root.py
    reviewboard/webapi/tests/test_file_attachment.py
    reviewboard/webapi/tests/mimetypes.py
    reviewboard/webapi/tests/test_review_group_user.py
    reviewboard/webapi/tests/test_repository_info.py
    reviewboard/webapi/tests/test_review_reply_diff_comment.py
    reviewboard/webapi/tests/test_screenshot_draft.py
    Ignored Files:

  2. Show all issues

    Col: 51
    E127 continuation line over-indented for visual indent

  3. 
      
reviewbot
  1. This is a review from Review Bot.
    Tool: Pyflakes
    Processed Files:
    reviewboard/webapi/tests/test_review_reply_screenshot_comment.py
    reviewboard/webapi/tests/test_review_screenshot_comment.py
    reviewboard/webapi/tests/test_file_diff_comment.py
    reviewboard/webapi/tests/test_watched_review_request.py
    reviewboard/webapi/tests/test_review.py
    reviewboard/webapi/tests/test_default_reviewer.py
    reviewboard/webapi/tests/test_draft_review_screenshot_comment.py
    reviewboard/webapi/tests/test_screenshot.py
    reviewboard/webapi/tests/test_repository_commits.py
    reviewboard/webapi/tests/test_review_comment.py
    reviewboard/webapi/tests/test_review_group.py
    reviewboard/webapi/tests/test_file_attachment_draft.py
    reviewboard/webapi/tests/test_change.py
    reviewboard/webapi/tests/test_review_reply.py
    reviewboard/webapi/tests/test_file_attachment_comment.py
    reviewboard/webapi/tests/urls.py
    reviewboard/webapi/tests/test_server_info.py
    reviewboard/webapi/tests/test_repository_branches.py
    reviewboard/webapi/tests/test_user.py
    reviewboard/webapi/tests/base.py
    reviewboard/webapi/tests/test_review_reply_file_attachment_comment.py
    reviewboard/webapi/tests/test_screenshot_comment.py
    reviewboard/webapi/tests/test_session.py
    reviewboard/webapi/tests/test_watched_review_group.py
    reviewboard/webapi/tests/test_review_request.py
    reviewboard/webapi/tests/test_review_request_draft.py
    reviewboard/webapi/tests/test_draft_review_file_attachment_comment.py
    reviewboard/webapi/base.py
    reviewboard/webapi/resources.py
    reviewboard/webapi/tests/test_diff.py
    reviewboard/webapi/tests/test_repository.py
    reviewboard/webapi/tests/test_validate_diff.py
    reviewboard/webapi/tests/test_root.py
    reviewboard/webapi/tests/test_file_attachment.py
    reviewboard/webapi/tests/mimetypes.py
    reviewboard/webapi/tests/test_review_group_user.py
    reviewboard/webapi/tests/test_repository_info.py
    reviewboard/webapi/tests/test_review_reply_diff_comment.py
    reviewboard/webapi/tests/test_screenshot_draft.py
    Ignored Files:

  2. 
      
david
  1. 
      
  2. reviewboard/webapi/tests/base.py (Diff revision 1)
     
     
     
    Show all issues

    If you put the ( on the first line, you can skip the \

  3. reviewboard/webapi/tests/base.py (Diff revision 1)
     
     
    Show all issues

    Same here.

  4. reviewboard/webapi/tests/mimetypes.py (Diff revision 1)
     
     
     
     
    Show all issues

    Can you put two lines in between each group?

  5. Show all issues

    Same comment with ( and \

  6. Show all issues

    And here.

  7. reviewboard/webapi/tests/test_review_comment.py (Diff revision 1)
     
     
     
     
     
     
     
    Show all issues

    And here.

  8. Show all issues

    And here

  9. Show all issues

    This doesn't need ()

  10. Show all issues

    Move the (

  11. Show all issues

    No ()

  12. Show all issues

    Move the (

  13. reviewboard/webapi/tests/test_watched_review_group.py (Diff revision 1)
     
     
     
     
     
     
    Show all issues

    Move (

  14. Show all issues

    Move (

  15. reviewboard/webapi/tests/urls.py (Diff revision 1)
     
     
     
    Show all issues

    Move (

  16. 
      
chipx86
reviewbot
  1. This is a review from Review Bot.
    Tool: PEP8 Style Checker
    Processed Files:
    reviewboard/webapi/tests/test_review_reply_screenshot_comment.py
    reviewboard/webapi/tests/test_review_screenshot_comment.py
    reviewboard/webapi/tests/test_file_diff_comment.py
    reviewboard/webapi/tests/test_watched_review_request.py
    reviewboard/webapi/tests/test_review.py
    reviewboard/webapi/tests/test_default_reviewer.py
    reviewboard/webapi/tests/test_draft_review_screenshot_comment.py
    reviewboard/webapi/tests/test_screenshot.py
    reviewboard/webapi/tests/test_repository_commits.py
    reviewboard/webapi/tests/test_review_comment.py
    reviewboard/webapi/tests/test_review_group.py
    reviewboard/webapi/tests/test_file_attachment_draft.py
    reviewboard/webapi/tests/test_change.py
    reviewboard/webapi/tests/test_review_reply.py
    reviewboard/webapi/tests/test_file_attachment_comment.py
    reviewboard/webapi/tests/urls.py
    reviewboard/webapi/tests/test_server_info.py
    reviewboard/webapi/tests/test_repository_branches.py
    reviewboard/webapi/tests/test_user.py
    reviewboard/webapi/tests/base.py
    reviewboard/webapi/tests/test_review_reply_file_attachment_comment.py
    reviewboard/webapi/tests/test_screenshot_comment.py
    reviewboard/webapi/tests/test_session.py
    reviewboard/webapi/tests/test_watched_review_group.py
    reviewboard/webapi/tests/test_review_request.py
    reviewboard/webapi/tests/test_review_request_draft.py
    reviewboard/webapi/tests/test_draft_review_file_attachment_comment.py
    reviewboard/webapi/base.py
    reviewboard/webapi/resources.py
    reviewboard/webapi/tests/test_diff.py
    reviewboard/webapi/tests/test_repository.py
    reviewboard/webapi/tests/test_validate_diff.py
    reviewboard/webapi/tests/test_root.py
    reviewboard/webapi/tests/test_file_attachment.py
    reviewboard/webapi/tests/mimetypes.py
    reviewboard/webapi/tests/test_review_group_user.py
    reviewboard/webapi/tests/test_repository_info.py
    reviewboard/webapi/tests/test_review_reply_diff_comment.py
    reviewboard/webapi/tests/test_screenshot_draft.py
    Ignored Files:

  2. 
      
reviewbot
  1. This is a review from Review Bot.
    Tool: Pyflakes
    Processed Files:
    reviewboard/webapi/tests/test_review_reply_screenshot_comment.py
    reviewboard/webapi/tests/test_review_screenshot_comment.py
    reviewboard/webapi/tests/test_file_diff_comment.py
    reviewboard/webapi/tests/test_watched_review_request.py
    reviewboard/webapi/tests/test_review.py
    reviewboard/webapi/tests/test_default_reviewer.py
    reviewboard/webapi/tests/test_draft_review_screenshot_comment.py
    reviewboard/webapi/tests/test_screenshot.py
    reviewboard/webapi/tests/test_repository_commits.py
    reviewboard/webapi/tests/test_review_comment.py
    reviewboard/webapi/tests/test_review_group.py
    reviewboard/webapi/tests/test_file_attachment_draft.py
    reviewboard/webapi/tests/test_change.py
    reviewboard/webapi/tests/test_review_reply.py
    reviewboard/webapi/tests/test_file_attachment_comment.py
    reviewboard/webapi/tests/urls.py
    reviewboard/webapi/tests/test_server_info.py
    reviewboard/webapi/tests/test_repository_branches.py
    reviewboard/webapi/tests/test_user.py
    reviewboard/webapi/tests/base.py
    reviewboard/webapi/tests/test_review_reply_file_attachment_comment.py
    reviewboard/webapi/tests/test_screenshot_comment.py
    reviewboard/webapi/tests/test_session.py
    reviewboard/webapi/tests/test_watched_review_group.py
    reviewboard/webapi/tests/test_review_request.py
    reviewboard/webapi/tests/test_review_request_draft.py
    reviewboard/webapi/tests/test_draft_review_file_attachment_comment.py
    reviewboard/webapi/base.py
    reviewboard/webapi/resources.py
    reviewboard/webapi/tests/test_diff.py
    reviewboard/webapi/tests/test_repository.py
    reviewboard/webapi/tests/test_validate_diff.py
    reviewboard/webapi/tests/test_root.py
    reviewboard/webapi/tests/test_file_attachment.py
    reviewboard/webapi/tests/mimetypes.py
    reviewboard/webapi/tests/test_review_group_user.py
    reviewboard/webapi/tests/test_repository_info.py
    reviewboard/webapi/tests/test_review_reply_diff_comment.py
    reviewboard/webapi/tests/test_screenshot_draft.py
    Ignored Files:

  2. 
      
david
  1. Ship It!

  2. 
      
chipx86
Review request changed
Status:
Completed