Fixed tests + fixture for issue2635

Review Request #3371 — Created Sept. 28, 2012 and submitted

Information

Review Board
release.1.6.x

Reviewers

Fixed tests + fixture for issue2635

- Bug fix for issue 2635 is broken down into 2 parts
- Part 1 of this fix is made in resources.py in an earlier commit
- Part 2 of this fix is made in the current commit: affected files are
  - reviewboard/reviews/fixtures/test_reviewrequests.json
  - reviewboard/webapi/tests.py
- Had run into a strange error: "DoesNotExist: LocalSite matching query
  does not exist.", which was solved by decorating the ship_it tests
  with @add_fixtures(['test_site'])
- In test_reviewrequests.json, corrected the shipit_count of a
  review-request with pk=2 from 0 to 1, as there is a review associated
  with that review-request with ship-it set to True

Merge branch 'release-1.6.x' into issue2635-slchen


Merge branch 'release-1.6.x' into issue2635-slchen


Fixed Issue: 2635 - "shipit=0" issue

- (release.1.6.x)
- see http://code.google.com/p/reviewboard/issues/detail?id=2635 for
  full details
- replaced (removed) exclude_q infrastructure for filtering
  review-requests based on ship-out counts
- instead uses existing q infrastructure for filtering (similar to how
  it is used for the other search parameters); fixed the filtering
  parameter for requests from "reviews__shipit" to "shipit_count"
Manual testing on local environment for release.1.6.x

david
  1. For your testing, did you test both shipit=1 and shipit=0?
    1. Manually tested with the following shell script: (see attached test-issue2635.sh)
      
      Visual inspect of results match expected output (on a database with 59 review-requests, 1 of which has 2 ship-its, 2 of which have 1 ship-it each, the rest having no ship-its)
      
      
      #!/bin/bash
      
      #1: ship-it=0
      # expecting only results with shipit_count == 0
      curl -H "Accept: application/json" -v -G "http://0.0.0.0:8080/api/review-requests/?ship-it=0" > result_0
      
      #2: ship-it=1
      # expecting only results with shipit_count == 1
      curl -H "Accept: application/json" -v -G "http://0.0.0.0:8080/api/review-requests/?ship-it=1" > result_1
      
      #3: no ship-it defined
      # expecting all review-requests
      curl -H "Accept: application/json" -v -G "http://0.0.0.0:8080/api/review-requests/" > result_normal
      
      #4: improperly defined ship-it param 1
      # expecting all review-requests
      curl -H "Accept: application/json" -v -G "http://0.0.0.0:8080/api/review-requests/?sh%20ip-it=0" > result_err_1
      
      #5: improperly defined ship-it param 2
      # expecting all review-requests
      curl -H "Accept: application/json" -v -G "http://0.0.0.0:8080/api/review-requests/?ship-it=55" > result_err_2
      
      #6: improperly defined ship-it param 3
      # expecting all review-requests
      curl -H "Accept: application/json" -v -G "http://0.0.0.0:8080/api/review-requests/?ship-it=okay" > result_err_3
      
      
      
    2. typo in the comments for the #2 test: it should read:
      # expecting only results with shipit_count > 0
    3. Could you add these cases in the test suite? See ReviewRequestResourceTests in reviewboard/webapi/tests.py
  2. 
      
SL
SL
SL
david
  1. Ship It!
  2. 
      
SL
Review request changed
Status:
Completed
Change Summary:
Pushed to master (12394ee). Thanks!