• 
      

    Add expected queries and enhance tests for Repository access queries.

    Review Request #13409 — Created Nov. 8, 2023 and submitted

    Information

    Review Board
    release-5.0.x

    Reviewers

    This adds pre-built expected queries for:

    • Repository.objects.accessible()
    • Repository.objects.accessible_ids()

    These functions live in reviewboard.scmtools.testing.queries, and can
    be reused throughout our test suite. It's written in a verbose manner
    that ensures we only ever test against finalized Q expressions, to
    minimize chances of regressions or unexpected behavior.

    The unit tests for .accessible() and .accessible_ids() have been
    completely rewritten. They now check against these expected queries, but
    they've also been expanded considerably to more thoroughly check access
    with positive and negative test data, to better catch regressions. The
    approach being used here will be carried over to other accessibility
    tests for the next batch of this peformance work.

    Unit tests pass.

    Summary ID
    Add expected queries and enhance tests for Repository access queries.
    This adds pre-built expected queries for: * `Repository.objects.accessible()` * `Repository.objects.accessible_ids()` These functions live in `reviewboard.scmtools.testing.queries`, and can be reused throughout our test suite. It's written in a verbose manner that ensures we only ever test against finalized Q expressions, to minimize chances of regressions or unexpected behavior. The unit tests for `.accessible()` and `.accessible_ids()` have been completely rewritten. They now check against these expected queries, but they've also been expanded considerably to more thoroughly check access with positive and negative test data, to better catch regressions. The approach being used here will be carried over to other accessibility tests for the next batch of this peformance work.
    c9d92274c8bd4324b397be9aaacca4ba12864433
    Description From Last Updated

    'typing.Optional' imported but unused Column: 1 Error code: F401

    reviewbotreviewbot

    'django.contrib.auth.models.Permission' imported but unused Column: 1 Error code: F401

    reviewbotreviewbot

    'reviewboard.accounts.models.LocalSiteProfile' imported but unused Column: 1 Error code: F401

    reviewbotreviewbot

    'reviewboard.accounts.models.Profile' imported but unused Column: 1 Error code: F401

    reviewbotreviewbot

    'reviewboard.reviews.models.Group' imported but unused Column: 1 Error code: F401

    reviewbotreviewbot
    Checks run (1 failed, 1 succeeded)
    flake8 failed.
    JSHint passed.

    flake8

    chipx86
    david
    1. Ship It!
    2. 
        
    chipx86
    david
    1. Ship It!
    2. 
        
    maubin
    1. Ship It!
    2. 
        
    chipx86
    Review request changed
    Status:
    Completed
    Change Summary:
    Pushed to release-5.0.x (4395857)