• Get Review Board
  • What's New
  • Products
  • Review Board Code review, image review, and document review
  • Documentation
  • Release Notes
  • Power Pack Enterprise integrations, reports, and enhanced document review
  • Try for 60 Days
  • Purchase
  • RBCommons Review Board as a Service, hosted by us
  • Pricing
  • RBTools Command line tools and Python API for Review Board
  • Documentation
  • Release Notes
  • Review Bot Automated code review, connecting tools you already use
  • Documentation
  • Release Notes
  • RB Gateway Manage Git and Mercurial repositories in your network
  • Documentation
  • Release Notes
  • Learn and Explore
  • What is Code Review?
  • Documentation
  • Frequently Asked Questions
  • Support Options
  • Third-Party Integrations
  • Demo
  • Review Board RBTools Power Pack Review Bot Djblets RB Gateway
    1. Review Board 7.x
    2. Version 7.x
    3. Version 6.x
    4. Version 5.0
    5. Version 4.0
    6. Version 3.0
    7. Version 2.5
    8. Version 2.0
    9. Version 1.7
    10. Version 1.6
    11. Version 1.5
    12. Version 1.0
    13. Extending Review Board
    14. Module and Class References
    15. reviewboard.testing.testcase
  • Home
  • Users Guide
  • Getting Started
  • Introduction
  • What is Code Review?
  • Review Board Workflows
  • Account Settings
  • Dashboard
  • Working with Review Requests
  • Overview
  • Creating Review Requests
  • Editing Fields
  • Uploading Diffs
  • Uploading File Attachments
  • Publishing Review Requests
  • Closing Review Requests
  • Reviewing
  • Reviews and Comments
  • The Review Banner
  • Managing and Publishing Drafts
  • Issue Tracking
  • Reviewing Code (Diffs)
  • Reviewing File Attachments
  • Reviewing Images
  • Reviewing Markdown Files
  • Reviewing Text Files
  • Creating and Editing Reviews
  • Approving Changes (Ship It!)
  • Replying to Comments
  • Automated Code Reviews
  • Searching
  • Quick Search
  • Full-Text Search
  • Using Markdown
  • Administration Guide
  • Installation
  • Installing Review Board
  • Linux System Compatibility
  • Installing with Docker
  • Manually Installing on Linux
  • Installing on macOS
  • Installing on Windows
  • Installing Development Releases
  • Creating a Review Board Site
  • Upgrading
  • Upgrading Review Board
  • Upgrading Review Board Sites
  • Optimization
  • Optimizing and Scaling Review Board
  • Administration UI
  • Overview of the Administration UI
  • Administrator Dashboard
  • Database Management
  • Configuration
  • Site Settings
  • General Settings
  • Authentication Settings
  • Avatar Services Settings
  • E-Mail Settings
  • Diff Viewer Settings
  • Logging Settings
  • SSH Settings
  • File Storage Settings
  • User Privacy Settings
  • Search Settings
  • Access Control
  • Working with E-Mail
  • Default Reviewers
  • Permission Groups
  • Repositories
  • Bazaar Repositories
  • CVS Repositories
  • Git Repositories
  • HCL VersionVault and IBM ClearCase
  • Mercurial Repositories
  • Perforce Repositories
  • Subversion Repositories
  • Assembla Repositories
  • AWS CodeCommit Repositories
  • Beanstalk Repositories
  • Bitbucket Repositories
  • Bitbucket Server Repositories
  • Codebase HQ Repositories
  • Fedora Hosted Repositories
  • Gerrit Repositories
  • GitHub Repositories
  • GitHub Enterprise Repositories
  • GitLab Repositories
  • Gitorious Repositories
  • Cliosoft SOS Repositories
  • SourceForge Repositories
  • Unfuddle STACK Repositories
  • VisualStudio.com Repositories
  • Review Groups
  • Users
  • WebHooks
  • Extensions
  • Integrations
  • Asana Integration
  • CircleCI Integration
  • Discord Integration
  • I Done This Integration
  • Jenkins CI Integration
  • Matrix Integration
  • Mattermost Integration
  • Microsoft Teams Integration
  • Slack Integration
  • Travis CI Integration
  • Trello Integration
  • Site Maintenance
  • The rb-site Tool
  • Advanced Management Commands
  • Monitoring Review Board
  • Health Checks
  • Web API Guide
  • Resource Tree
  • Resources
  • Root List Resource
  • Default Reviewer List Resource
  • Default Reviewer Resource
  • Extension List Resource
  • Extension Resource
  • Hosting Service Account List Resource
  • Hosting Service Account Resource
  • Remote Repository List Resource
  • Hosting Service List Resource
  • Hosting Service Resource
  • OAuth2 Applications List Resource
  • OAuth2 Applications Resource
  • OAuth2 Tokens List Resource
  • OAuth2 Tokens Resource
  • Repository List Resource
  • Repository Resource
  • Diff File Attachment List Resource
  • Repository Branches Resource
  • Repository Commits Resource
  • Repository Group List Resource
  • Repository Info Resource
  • Repository User List Resource
  • Review Group List Resource
  • Review Group Resource
  • Review Group User List Resource
  • Review Request List Resource
  • Review Request Resource
  • Change List Resource
  • Diff Context Resource
  • Diff List Resource
  • File Attachment List Resource
  • Review List Resource
  • Review Request Draft Resource
  • Review Request Last Update Resource
  • Screenshot List Resource
  • Status Update List Resource
  • Root Diff Comment List Resource
  • Root File Attachment Comment List Resource
  • Root General Comment List Resource
  • Root Review List Resource
  • Search Resource
  • Server Info Resource
  • Session Resource
  • User List Resource
  • User Resource
  • API Token List Resource
  • Archived Review Request List Resource
  • Muted Review Request List Resource
  • User File Attachment List Resource
  • Watched List Resource
  • Validation List Resource
  • Validate Diff List Resource
  • Validate Diff Commit List Resource
  • WebHook List Resource
  • WebHook Resource
  • Server Info Resource
  • Default Reviewer List Resource
  • Default Reviewer Resource
  • Default Reviewer Resource
  • Diff Context Resource
  • Diff List Resource
  • Diff Resource
  • Diff Commit List Resource
  • Diff Commit Resource
  • File Diff List Resource
  • File Diff Resource
  • Diff Resource
  • Diff Commit List Resource
  • Diff Commit Resource
  • File Diff List Resource
  • File Diff Resource
  • File Diff Comment List Resource
  • Original File Resource
  • Patched File Resource
  • Diff Commit List Resource
  • Diff Commit Resource
  • Diff Commit Resource
  • Diff File Attachment List Resource
  • Diff File Attachment Resource
  • Diff File Attachment Resource
  • Original File Resource
  • Patched File Resource
  • Extension List Resource
  • Extension Resource
  • Extension Resource
  • Hosting Service List Resource
  • Hosting Service Resource
  • Hosting Service Resource
  • Hosting Service Account List Resource
  • Hosting Service Account Resource
  • Remote Repository List Resource
  • Remote Repository Resource
  • Hosting Service Account Resource
  • Remote Repository List Resource
  • Remote Repository Resource
  • Remote Repository List Resource
  • Remote Repository Resource
  • Remote Repository Resource
  • OAuth2 Applications List Resource
  • OAuth2 Applications Resource
  • OAuth2 Applications Resource
  • OAuth2 Tokens List Resource
  • OAuth2 Tokens Resource
  • OAuth2 Tokens Resource
  • Repository List Resource
  • Repository Resource
  • Diff File Attachment List Resource
  • Diff File Attachment Resource
  • Repository Branches Resource
  • Repository Commits Resource
  • Repository Group List Resource
  • Repository Group Resource
  • Repository Info Resource
  • Repository User List Resource
  • Repository User Resource
  • Repository Resource
  • Diff File Attachment List Resource
  • Diff File Attachment Resource
  • Repository Branches Resource
  • Repository Commits Resource
  • Repository Group List Resource
  • Repository Group Resource
  • Repository Info Resource
  • Repository User List Resource
  • Repository User Resource
  • Repository Branches Resource
  • Repository Commits Resource
  • Repository Group List Resource
  • Repository Group Resource
  • Repository Group Resource
  • Repository Info Resource
  • Repository User List Resource
  • Repository User Resource
  • Repository User Resource
  • Review Group List Resource
  • Review Group Resource
  • Review Group User List Resource
  • Review Group User Resource
  • Review Group Resource
  • Review Group User List Resource
  • Review Group User Resource
  • Review Group User List Resource
  • Review Group User Resource
  • Review Group User Resource
  • Change List Resource
  • Change Resource
  • Change Resource
  • File Attachment List Resource
  • File Attachment Resource
  • File Attachment Comment List Resource
  • File Attachment Resource
  • File Attachment Comment List Resource
  • File Attachment Comment List Resource
  • File Diff List Resource
  • File Diff Resource
  • File Diff Comment List Resource
  • Original File Resource
  • Patched File Resource
  • File Diff Resource
  • File Diff Comment List Resource
  • Original File Resource
  • Patched File Resource
  • File Diff Comment List Resource
  • Review Request List Resource
  • Review Request Resource
  • Change List Resource
  • Change Resource
  • Diff Context Resource
  • Diff List Resource
  • Diff Resource
  • File Attachment List Resource
  • File Attachment Resource
  • Review List Resource
  • Review Resource
  • Review Draft Resource
  • Review Request Draft Resource
  • Draft Diff List Resource
  • Draft File Attachment List Resource
  • Draft Screenshot List Resource
  • Review Request Last Update Resource
  • Screenshot List Resource
  • Screenshot Resource
  • Status Update List Resource
  • Status Update Resource
  • Review Request Resource
  • Change List Resource
  • Change Resource
  • Diff Context Resource
  • Diff List Resource
  • Diff Resource
  • Diff Commit List Resource
  • File Diff List Resource
  • File Attachment List Resource
  • File Attachment Resource
  • File Attachment Comment List Resource
  • Review List Resource
  • Review Resource
  • Review Diff Comment List Resource
  • Review File Attachment Comment List Resource
  • Review General Comment List Resource
  • Review Reply List Resource
  • Review Screenshot Comment List Resource
  • Review Draft Resource
  • Review Request Draft Resource
  • Draft Diff List Resource
  • Draft Diff Resource
  • Draft File Attachment List Resource
  • Draft File Attachment Resource
  • Draft Screenshot List Resource
  • Draft Screenshot Resource
  • Review Request Last Update Resource
  • Screenshot List Resource
  • Screenshot Resource
  • Screenshot Comment List Resource
  • Status Update List Resource
  • Status Update Resource
  • Review Request Last Update Resource
  • Screenshot List Resource
  • Screenshot Resource
  • Screenshot Comment List Resource
  • Screenshot Resource
  • Screenshot Comment List Resource
  • Screenshot Comment List Resource
  • Draft Diff List Resource
  • Draft Diff Resource
  • Draft Diff Commit List Resource
  • Draft Diff Commit Resource
  • Draft File Diff List Resource
  • Draft File Diff Resource
  • Draft Diff Resource
  • Draft Diff Commit List Resource
  • Draft Diff Commit Resource
  • Draft File Diff List Resource
  • Draft File Diff Resource
  • Draft Original File Resource
  • Draft Patched File Resource
  • Draft Diff Commit List Resource
  • Draft Diff Commit Resource
  • Draft Diff Commit Resource
  • Draft File Diff List Resource
  • Draft File Diff Resource
  • Draft Original File Resource
  • Draft Patched File Resource
  • Draft File Diff Resource
  • Draft Original File Resource
  • Draft Patched File Resource
  • Draft File Attachment List Resource
  • Draft File Attachment Resource
  • Draft File Attachment Resource
  • Draft Original File Resource
  • Draft Patched File Resource
  • Draft Screenshot List Resource
  • Draft Screenshot Resource
  • Draft Screenshot Resource
  • Review Request Draft Resource
  • Draft Diff List Resource
  • Draft Diff Resource
  • Draft Diff Commit List Resource
  • Draft File Diff List Resource
  • Draft File Attachment List Resource
  • Draft File Attachment Resource
  • Draft Screenshot List Resource
  • Draft Screenshot Resource
  • Root Review List Resource
  • Root Diff Comment List Resource
  • Root File Attachment Comment List Resource
  • Root General Comment List Resource
  • Review List Resource
  • Review Resource
  • Review Diff Comment List Resource
  • Review Diff Comment Resource
  • Review File Attachment Comment List Resource
  • Review File Attachment Comment Resource
  • Review General Comment List Resource
  • Review General Comment Resource
  • Review Reply List Resource
  • Review Reply Resource
  • Review Reply Draft Resource
  • Review Screenshot Comment List Resource
  • Review Screenshot Comment Resource
  • Review Draft Resource
  • Review Resource
  • Review Diff Comment List Resource
  • Review Diff Comment Resource
  • Review File Attachment Comment List Resource
  • Review File Attachment Comment Resource
  • Review General Comment List Resource
  • Review General Comment Resource
  • Review Reply List Resource
  • Review Reply Resource
  • Review Reply Diff Comment List Resource
  • Review Reply File Attachment Comment List Resource
  • Review Reply General Comment List Resource
  • Review Reply Screenshot Comment List Resource
  • Review Reply Draft Resource
  • Review Screenshot Comment List Resource
  • Review Screenshot Comment Resource
  • Review Draft Resource
  • Review Diff Comment List Resource
  • Review Diff Comment Resource
  • Review Diff Comment Resource
  • Review File Attachment Comment List Resource
  • Review File Attachment Comment Resource
  • Review File Attachment Comment Resource
  • Review General Comment List Resource
  • Review General Comment Resource
  • Review General Comment Resource
  • Review Screenshot Comment List Resource
  • Review Screenshot Comment Resource
  • Review Screenshot Comment Resource
  • Review Reply Draft Resource
  • Review Reply List Resource
  • Review Reply Resource
  • Review Reply Diff Comment List Resource
  • Review Reply Diff Comment Resource
  • Review Reply File Attachment Comment List Resource
  • Review Reply File Attachment Comment Resource
  • Review Reply General Comment List Resource
  • Review Reply General Comment Resource
  • Review Reply Screenshot Comment List Resource
  • Review Reply Screenshot Comment Resource
  • Review Reply Draft Resource
  • Review Reply Resource
  • Review Reply Diff Comment List Resource
  • Review Reply Diff Comment Resource
  • Review Reply File Attachment Comment List Resource
  • Review Reply File Attachment Comment Resource
  • Review Reply General Comment List Resource
  • Review Reply General Comment Resource
  • Review Reply Screenshot Comment List Resource
  • Review Reply Screenshot Comment Resource
  • Review Reply Diff Comment List Resource
  • Review Reply Diff Comment Resource
  • Review Reply Diff Comment Resource
  • Review Reply File Attachment Comment List Resource
  • Review Reply File Attachment Comment Resource
  • Review Reply File Attachment Comment Resource
  • Review Reply General Comment List Resource
  • Review Reply General Comment Resource
  • Review Reply General Comment Resource
  • Review Reply Screenshot Comment List Resource
  • Review Reply Screenshot Comment Resource
  • Review Reply Screenshot Comment Resource
  • Search Resource
  • Status Update List Resource
  • Status Update Resource
  • Status Update Resource
  • API Token List Resource
  • API Token Resource
  • API Token Resource
  • Archived Review Request List Resource
  • Archived Review Request Resource
  • Archived Review Request Resource
  • Muted Review Request List Resource
  • Muted Review Request Resource
  • Muted Review Request Resource
  • Session Resource
  • User List Resource
  • User Resource
  • API Token List Resource
  • API Token Resource
  • Archived Review Request List Resource
  • Archived Review Request Resource
  • Muted Review Request List Resource
  • Muted Review Request Resource
  • User File Attachment List Resource
  • User File Attachment Resource
  • Watched List Resource
  • Watched Review Group List Resource
  • Watched Review Request List Resource
  • User Resource
  • API Token List Resource
  • API Token Resource
  • Archived Review Request List Resource
  • Archived Review Request Resource
  • Muted Review Request List Resource
  • Muted Review Request Resource
  • User File Attachment List Resource
  • User File Attachment Resource
  • Watched List Resource
  • Watched Review Group List Resource
  • Watched Review Group Resource
  • Watched Review Request List Resource
  • Watched Review Request Resource
  • User File Attachment List Resource
  • User File Attachment Resource
  • User File Attachment Resource
  • Watched Review Group List Resource
  • Watched Review Group Resource
  • Watched Review Group Resource
  • Watched Review Request List Resource
  • Watched Review Request Resource
  • Watched Review Request Resource
  • Watched List Resource
  • Watched Review Group List Resource
  • Watched Review Group Resource
  • Watched Review Request List Resource
  • Watched Review Request Resource
  • Validation List Resource
  • Validate Diff List Resource
  • Validate Diff Commit List Resource
  • Validate Diff List Resource
  • Validate Diff Commit List Resource
  • WebHook List Resource
  • WebHook Resource
  • WebHook Resource
  • Errors
  • 100 - Does Not Exist
  • 101 - Permission Denied
  • 102 - Invalid Attribute
  • 103 - Not Logged In
  • 104 - Login Failed
  • 105 - Invalid Form Data
  • 106 - Missing Attribute
  • 107 - Enable Extension Failed
  • 108 - Disable Extension Failed
  • 109 - Extension Already Installed
  • 110 - Install Extension Failed
  • 111 - Duplicate Item
  • 112 - OAuth2 Missing Scope Error
  • 113 - OAuth2 Access Denied Error
  • 114 - Rate Limit Exceeded
  • 203 - Invalid Change Number
  • 204 - Change Number In Use
  • 205 - Missing Repository
  • 206 - Invalid Repository
  • 207 - Repository File Not Found
  • 208 - Invalid User
  • 209 - Repository Action Not Supported
  • 210 - Repository Information Error
  • 212 - Empty Changeset
  • 213 - Server Configuration Error
  • 214 - Bad Host Key
  • 215 - Unverified Host Key
  • 216 - Unverified Host Certificate
  • 217 - Missing User Key
  • 218 - Repository Authentication Error
  • 219 - Diff Empty
  • 220 - Diff Too Big
  • 221 - File Retrieval Error
  • 222 - Hosting Service Authentication Error
  • 223 - Group Already Exists
  • 224 - Diff Parse Error
  • 225 - Publish Error
  • 226 - User Query Error
  • 227 - Commit ID Already Exists
  • 228 - Token Generation Failed
  • 230 - Could not close review request
  • 231 - Could not reopen review request
  • 232 - Ship-It Revocation Error
  • REST API 2.0
  • Overview
  • Authenticating
  • API Token Policies
  • OAuth2 Authentication
  • Rich Text Fields and Types
  • Storing/Accessing Extra Data
  • Resources
  • Root List Resource
  • Default Reviewer List Resource
  • Default Reviewer Resource
  • Extension List Resource
  • Extension Resource
  • Hosting Service Account List Resource
  • Hosting Service Account Resource
  • Hosting Service List Resource
  • Hosting Service Resource
  • OAuth2 Applications List Resource
  • OAuth2 Applications Resource
  • OAuth2 Tokens List Resource
  • OAuth2 Tokens Resource
  • Repository List Resource
  • Repository Resource
  • Review Group List Resource
  • Review Group Resource
  • Review Request List Resource
  • Review Request Resource
  • Root Diff Comment List Resource
  • Root File Attachment Comment List Resource
  • Root General Comment List Resource
  • Root Review List Resource
  • Search Resource
  • Server Info Resource
  • Session Resource
  • User List Resource
  • User Resource
  • Validation List Resource
  • Validate Diff List Resource
  • Validate Diff Commit List Resource
  • WebHook List Resource
  • WebHook Resource
  • Server Info Resource
  • Default Reviewer List Resource
  • Default Reviewer Resource
  • Default Reviewer Resource
  • Diff Context Resource
  • Diff List Resource
  • Diff Resource
  • Diff Commit List Resource
  • File Diff List Resource
  • Diff Resource
  • Diff Commit List Resource
  • Diff Commit Resource
  • File Diff List Resource
  • File Diff Resource
  • Diff Commit List Resource
  • Diff Commit Resource
  • Diff Commit Resource
  • Diff File Attachment List Resource
  • Diff File Attachment Resource
  • Diff File Attachment Resource
  • Original File Resource
  • Patched File Resource
  • Extension List Resource
  • Extension Resource
  • Extension Resource
  • Hosting Service List Resource
  • Hosting Service Resource
  • Hosting Service Resource
  • Hosting Service Account List Resource
  • Hosting Service Account Resource
  • Remote Repository List Resource
  • Hosting Service Account Resource
  • Remote Repository List Resource
  • Remote Repository Resource
  • Remote Repository List Resource
  • Remote Repository Resource
  • Remote Repository Resource
  • OAuth2 Applications List Resource
  • OAuth2 Applications Resource
  • OAuth2 Applications Resource
  • OAuth2 Tokens List Resource
  • OAuth2 Tokens Resource
  • OAuth2 Tokens Resource
  • Repository List Resource
  • Repository Resource
  • Diff File Attachment List Resource
  • Repository Branches Resource
  • Repository Commits Resource
  • Repository Group List Resource
  • Repository Info Resource
  • Repository User List Resource
  • Repository Resource
  • Diff File Attachment List Resource
  • Diff File Attachment Resource
  • Repository Branches Resource
  • Repository Commits Resource
  • Repository Group List Resource
  • Repository Group Resource
  • Repository Info Resource
  • Repository User List Resource
  • Repository User Resource
  • Repository Branches Resource
  • Repository Commits Resource
  • Repository Group List Resource
  • Repository Group Resource
  • Repository Group Resource
  • Repository Info Resource
  • Repository User List Resource
  • Repository User Resource
  • Repository User Resource
  • Review Group List Resource
  • Review Group Resource
  • Review Group User List Resource
  • Review Group Resource
  • Review Group User List Resource
  • Review Group User Resource
  • Review Group User List Resource
  • Review Group User Resource
  • Review Group User Resource
  • Change List Resource
  • Change Resource
  • Change Resource
  • File Attachment List Resource
  • File Attachment Resource
  • File Attachment Comment List Resource
  • File Attachment Resource
  • File Attachment Comment List Resource
  • File Attachment Comment List Resource
  • File Diff List Resource
  • File Diff Resource
  • File Diff Comment List Resource
  • Original File Resource
  • Patched File Resource
  • File Diff Resource
  • File Diff Comment List Resource
  • Original File Resource
  • Patched File Resource
  • File Diff Comment List Resource
  • Review Request List Resource
  • Review Request Resource
  • Change List Resource
  • Diff Context Resource
  • Diff List Resource
  • File Attachment List Resource
  • Review List Resource
  • Review Request Draft Resource
  • Review Request Last Update Resource
  • Screenshot List Resource
  • Status Update List Resource
  • Review Request Resource
  • Change List Resource
  • Change Resource
  • Diff Context Resource
  • Diff List Resource
  • Diff Resource
  • File Attachment List Resource
  • File Attachment Resource
  • Review List Resource
  • Review Resource
  • Review Draft Resource
  • Review Request Draft Resource
  • Draft Diff List Resource
  • Draft File Attachment List Resource
  • Draft Screenshot List Resource
  • Review Request Last Update Resource
  • Screenshot List Resource
  • Screenshot Resource
  • Status Update List Resource
  • Status Update Resource
  • Review Request Last Update Resource
  • Screenshot List Resource
  • Screenshot Resource
  • Screenshot Comment List Resource
  • Screenshot Resource
  • Screenshot Comment List Resource
  • Screenshot Comment List Resource
  • Draft Diff List Resource
  • Draft Diff Resource
  • Draft Diff Commit List Resource
  • Draft File Diff List Resource
  • Draft Diff Resource
  • Draft Diff Commit List Resource
  • Draft Diff Commit Resource
  • Draft File Diff List Resource
  • Draft File Diff Resource
  • Draft Diff Commit List Resource
  • Draft Diff Commit Resource
  • Draft Diff Commit Resource
  • Draft File Diff List Resource
  • Draft File Diff Resource
  • Draft Original File Resource
  • Draft Patched File Resource
  • Draft File Diff Resource
  • Draft Original File Resource
  • Draft Patched File Resource
  • Draft File Attachment List Resource
  • Draft File Attachment Resource
  • Draft File Attachment Resource
  • Draft Original File Resource
  • Draft Patched File Resource
  • Draft Screenshot List Resource
  • Draft Screenshot Resource
  • Draft Screenshot Resource
  • Review Request Draft Resource
  • Draft Diff List Resource
  • Draft Diff Resource
  • Draft File Attachment List Resource
  • Draft File Attachment Resource
  • Draft Screenshot List Resource
  • Draft Screenshot Resource
  • Root Review List Resource
  • Root Diff Comment List Resource
  • Root File Attachment Comment List Resource
  • Root General Comment List Resource
  • Review List Resource
  • Review Resource
  • Review Diff Comment List Resource
  • Review File Attachment Comment List Resource
  • Review General Comment List Resource
  • Review Reply List Resource
  • Review Screenshot Comment List Resource
  • Review Draft Resource
  • Review Resource
  • Review Diff Comment List Resource
  • Review Diff Comment Resource
  • Review File Attachment Comment List Resource
  • Review File Attachment Comment Resource
  • Review General Comment List Resource
  • Review General Comment Resource
  • Review Reply List Resource
  • Review Reply Resource
  • Review Reply Draft Resource
  • Review Screenshot Comment List Resource
  • Review Screenshot Comment Resource
  • Review Draft Resource
  • Review Diff Comment List Resource
  • Review Diff Comment Resource
  • Review Diff Comment Resource
  • Review File Attachment Comment List Resource
  • Review File Attachment Comment Resource
  • Review File Attachment Comment Resource
  • Review General Comment List Resource
  • Review General Comment Resource
  • Review General Comment Resource
  • Review Screenshot Comment List Resource
  • Review Screenshot Comment Resource
  • Review Screenshot Comment Resource
  • Review Reply Draft Resource
  • Review Reply List Resource
  • Review Reply Resource
  • Review Reply Diff Comment List Resource
  • Review Reply File Attachment Comment List Resource
  • Review Reply General Comment List Resource
  • Review Reply Screenshot Comment List Resource
  • Review Reply Draft Resource
  • Review Reply Resource
  • Review Reply Diff Comment List Resource
  • Review Reply Diff Comment Resource
  • Review Reply File Attachment Comment List Resource
  • Review Reply File Attachment Comment Resource
  • Review Reply General Comment List Resource
  • Review Reply General Comment Resource
  • Review Reply Screenshot Comment List Resource
  • Review Reply Screenshot Comment Resource
  • Review Reply Diff Comment List Resource
  • Review Reply Diff Comment Resource
  • Review Reply Diff Comment Resource
  • Review Reply File Attachment Comment List Resource
  • Review Reply File Attachment Comment Resource
  • Review Reply File Attachment Comment Resource
  • Review Reply General Comment List Resource
  • Review Reply General Comment Resource
  • Review Reply General Comment Resource
  • Review Reply Screenshot Comment List Resource
  • Review Reply Screenshot Comment Resource
  • Review Reply Screenshot Comment Resource
  • Search Resource
  • Status Update List Resource
  • Status Update Resource
  • Status Update Resource
  • API Token List Resource
  • API Token Resource
  • API Token Resource
  • Archived Review Request List Resource
  • Archived Review Request Resource
  • Archived Review Request Resource
  • Muted Review Request List Resource
  • Muted Review Request Resource
  • Muted Review Request Resource
  • Session Resource
  • User List Resource
  • User Resource
  • API Token List Resource
  • Archived Review Request List Resource
  • Muted Review Request List Resource
  • User File Attachment List Resource
  • Watched List Resource
  • User Resource
  • API Token List Resource
  • API Token Resource
  • Archived Review Request List Resource
  • Archived Review Request Resource
  • Muted Review Request List Resource
  • Muted Review Request Resource
  • User File Attachment List Resource
  • User File Attachment Resource
  • Watched List Resource
  • Watched Review Group List Resource
  • Watched Review Request List Resource
  • User File Attachment List Resource
  • User File Attachment Resource
  • User File Attachment Resource
  • Watched Review Group List Resource
  • Watched Review Group Resource
  • Watched Review Group Resource
  • Watched Review Request List Resource
  • Watched Review Request Resource
  • Watched Review Request Resource
  • Watched List Resource
  • Watched Review Group List Resource
  • Watched Review Group Resource
  • Watched Review Request List Resource
  • Watched Review Request Resource
  • Validation List Resource
  • Validate Diff List Resource
  • Validate Diff Commit List Resource
  • Validate Diff List Resource
  • Validate Diff Commit List Resource
  • WebHook List Resource
  • WebHook Resource
  • WebHook Resource
  • Errors
  • 100 - Does Not Exist
  • 101 - Permission Denied
  • 102 - Invalid Attribute
  • 103 - Not Logged In
  • 104 - Login Failed
  • 105 - Invalid Form Data
  • 106 - Missing Attribute
  • 107 - Enable Extension Failed
  • 108 - Disable Extension Failed
  • 109 - Extension Already Installed
  • 110 - Install Extension Failed
  • 111 - Duplicate Item
  • 112 - OAuth2 Missing Scope Error
  • 113 - OAuth2 Access Denied Error
  • 114 - Rate Limit Exceeded
  • 203 - Invalid Change Number
  • 204 - Change Number In Use
  • 205 - Missing Repository
  • 206 - Invalid Repository
  • 207 - Repository File Not Found
  • 208 - Invalid User
  • 209 - Repository Action Not Supported
  • 210 - Repository Information Error
  • 212 - Empty Changeset
  • 213 - Server Configuration Error
  • 214 - Bad Host Key
  • 215 - Unverified Host Key
  • 216 - Unverified Host Certificate
  • 217 - Missing User Key
  • 218 - Repository Authentication Error
  • 219 - Diff Empty
  • 220 - Diff Too Big
  • 221 - File Retrieval Error
  • 222 - Hosting Service Authentication Error
  • 223 - Group Already Exists
  • 224 - Diff Parse Error
  • 225 - Publish Error
  • 226 - User Query Error
  • 227 - Commit ID Already Exists
  • 228 - Token Generation Failed
  • 230 - Could not close review request
  • 231 - Could not reopen review request
  • 232 - Ship-It Revocation Error
  • Glossary
  • Extending Review Board
  • Extension Files/Package Layout
  • Creating an Extension Class
  • Extension Configuration
  • Database Models
  • Extension Static Media Files
  • JavaScript Extensions
  • Testing Extensions
  • Extension Distribution
  • Writing Review Board Extensions
  • The rbext Tool
  • Extension Hooks
  • AccountPageFormsHook
  • AccountPagesHook
  • Action Hooks
  • AdminWidgetHook
  • APIExtraDataAccessHook
  • AuthBackendHook
  • AvatarServiceHook
  • CommentDetailDisplayHook
  • DashboardColumnsHook
  • DashboardSidebarItemsHook
  • DataGridColumnsHook
  • EmailHook
  • ReviewRequestPublishedEmailHook
  • ReviewRequestClosedEmailHook
  • ReviewPublishedEmailHook
  • ReviewReplyPublishedEmailHook
  • FileAttachmentThumbnailHook
  • FileDiffACLHook
  • HostingServiceHook
  • IntegrationHook
  • NavigationBarHook
  • ReviewRequestApprovalHook
  • ReviewRequestFieldsHook
  • ReviewRequestFieldSetsHook
  • ReviewUIHook
  • SCMToolHook
  • SignalHook
  • TemplateHook
  • URLHook
  • UserInfoboxHook
  • UserPageSidebarItemsHook
  • WebAPICapabilitiesHook
  • JavaScript Extension Hooks
  • CommentDialogHook
  • FileAttachmentThumbnailContainerHook
  • ReviewDialogCommentHook
  • ReviewDialogHook
  • Adding Review Request Fields
  • Review UI Integration
  • Writing Authentication Backends
  • Writing Legacy Authentication Backends
  • Extending the Web API
  • Module and Class References
  • reviewboard
  • reviewboard.deprecation
  • reviewboard.rb_platform
  • reviewboard.signals
  • reviewboard.accounts.backends
  • reviewboard.accounts.backends.ad
  • reviewboard.accounts.backends.base
  • reviewboard.accounts.backends.http_digest
  • reviewboard.accounts.backends.ldap
  • reviewboard.accounts.backends.nis
  • reviewboard.accounts.backends.registry
  • reviewboard.accounts.backends.standard
  • reviewboard.accounts.backends.x509
  • reviewboard.accounts.decorators
  • reviewboard.accounts.errors
  • reviewboard.accounts.forms.auth
  • reviewboard.accounts.forms.pages
  • reviewboard.accounts.forms.registration
  • reviewboard.accounts.managers
  • reviewboard.accounts.middleware
  • reviewboard.accounts.mixins
  • reviewboard.accounts.models
  • reviewboard.accounts.pages
  • reviewboard.accounts.privacy
  • reviewboard.accounts.templatetags.accounts
  • reviewboard.accounts.testing
  • reviewboard.accounts.testing.queries
  • reviewboard.accounts.trophies
  • reviewboard.actions
  • reviewboard.actions.base
  • reviewboard.actions.errors
  • reviewboard.actions.registry
  • reviewboard.admin
  • reviewboard.admin.admin_sites
  • reviewboard.admin.cache_stats
  • reviewboard.admin.checks
  • reviewboard.admin.decorators
  • reviewboard.admin.form_widgets
  • reviewboard.admin.middleware
  • reviewboard.admin.model_admin
  • reviewboard.admin.security_checks
  • reviewboard.admin.server
  • reviewboard.admin.siteconfig
  • reviewboard.admin.support
  • reviewboard.admin.validation
  • reviewboard.admin.widgets
  • reviewboard.attachments.errors
  • reviewboard.attachments.forms
  • reviewboard.attachments.managers
  • reviewboard.attachments.mimetypes
  • reviewboard.attachments.models
  • reviewboard.avatars.registry
  • reviewboard.avatars.services
  • reviewboard.avatars.settings
  • reviewboard.avatars.templatetags.avatars
  • reviewboard.avatars.testcase
  • reviewboard.changedescs.models
  • reviewboard.datagrids.columns
  • reviewboard.datagrids.grids
  • reviewboard.datagrids.sidebar
  • reviewboard.diffviewer.chunk_generator
  • reviewboard.diffviewer.differ
  • reviewboard.diffviewer.diffutils
  • reviewboard.diffviewer.errors
  • reviewboard.diffviewer.forms
  • reviewboard.diffviewer.managers
  • reviewboard.diffviewer.models
  • reviewboard.diffviewer.models.diffcommit
  • reviewboard.diffviewer.models.diffset
  • reviewboard.diffviewer.models.diffset_history
  • reviewboard.diffviewer.models.filediff
  • reviewboard.diffviewer.models.legacy_file_diff_data
  • reviewboard.diffviewer.models.raw_file_diff_data
  • reviewboard.diffviewer.myersdiff
  • reviewboard.diffviewer.opcode_generator
  • reviewboard.diffviewer.parser
  • reviewboard.diffviewer.processors
  • reviewboard.diffviewer.renderers
  • reviewboard.diffviewer.smdiff
  • reviewboard.certs
  • reviewboard.certs.cert
  • reviewboard.certs.errors
  • reviewboard.extensions.base
  • reviewboard.extensions.hooks
  • reviewboard.extensions.packaging
  • reviewboard.extensions.testing
  • reviewboard.extensions.testing.testcases
  • reviewboard.hostingsvcs.base
  • reviewboard.hostingsvcs.base.client
  • reviewboard.hostingsvcs.base.forms
  • reviewboard.hostingsvcs.base.hosting_service
  • reviewboard.hostingsvcs.base.http
  • reviewboard.hostingsvcs.base.paginator
  • reviewboard.hostingsvcs.base.registry
  • reviewboard.hostingsvcs.base.repository
  • reviewboard.hostingsvcs.errors
  • reviewboard.hostingsvcs.forms
  • reviewboard.hostingsvcs.hook_utils
  • reviewboard.hostingsvcs.models
  • reviewboard.hostingsvcs.repository
  • reviewboard.hostingsvcs.service
  • reviewboard.hostingsvcs.testing
  • reviewboard.hostingsvcs.testing.testcases
  • reviewboard.hostingsvcs.utils.paginator
  • reviewboard.integrations
  • reviewboard.integrations.base
  • reviewboard.integrations.forms
  • reviewboard.integrations.models
  • reviewboard.integrations.urls
  • reviewboard.integrations.views
  • reviewboard.notifications
  • reviewboard.notifications.email
  • reviewboard.notifications.email.backend
  • reviewboard.notifications.email.decorators
  • reviewboard.notifications.email.hooks
  • reviewboard.notifications.email.message
  • reviewboard.notifications.email.utils
  • reviewboard.notifications.email.views
  • reviewboard.notifications.forms
  • reviewboard.notifications.managers
  • reviewboard.notifications.models
  • reviewboard.notifications.webhooks
  • reviewboard.reviews.actions
  • reviewboard.reviews.builtin_fields
  • reviewboard.reviews.chunk_generators
  • reviewboard.reviews.conditions
  • reviewboard.reviews.context
  • reviewboard.reviews.default_actions
  • reviewboard.reviews.detail
  • reviewboard.reviews.errors
  • reviewboard.reviews.features
  • reviewboard.reviews.fields
  • reviewboard.reviews.forms
  • reviewboard.reviews.managers
  • reviewboard.reviews.markdown_utils
  • reviewboard.reviews.models
  • reviewboard.reviews.signals
  • reviewboard.reviews.templatetags.reviewtags
  • reviewboard.reviews.testing
  • reviewboard.reviews.testing.queries
  • reviewboard.reviews.testing.queries.review_groups
  • reviewboard.reviews.testing.queries.review_requests
  • reviewboard.reviews.testing.queries.reviews
  • reviewboard.reviews.ui.base
  • reviewboard.reviews.ui.image
  • reviewboard.reviews.ui.markdownui
  • reviewboard.reviews.ui.text
  • reviewboard.reviews.views.attachments
  • reviewboard.reviews.views.bug_trackers
  • reviewboard.reviews.views.diff_fragments
  • reviewboard.reviews.views.diffviewer
  • reviewboard.reviews.views.download_diff
  • reviewboard.reviews.views.email
  • reviewboard.reviews.views.mixins
  • reviewboard.reviews.views.new_review_request
  • reviewboard.reviews.views.review_request_detail
  • reviewboard.reviews.views.review_request_infobox
  • reviewboard.reviews.views.review_request_updates
  • reviewboard.reviews.views.root
  • reviewboard.scmtools.certs
  • reviewboard.scmtools.conditions
  • reviewboard.scmtools.core
  • reviewboard.scmtools.crypto_utils
  • reviewboard.scmtools.errors
  • reviewboard.scmtools.forms
  • reviewboard.scmtools.managers
  • reviewboard.scmtools.models
  • reviewboard.scmtools.signals
  • reviewboard.scmtools.testing
  • reviewboard.scmtools.testing.queries
  • reviewboard.scmtools.tests.testcases
  • reviewboard.search.fields
  • reviewboard.search.forms
  • reviewboard.search.indexes
  • reviewboard.search.search_backends.base
  • reviewboard.search.search_backends.elasticsearch
  • reviewboard.search.search_backends.registry
  • reviewboard.search.search_backends.whoosh
  • reviewboard.search.signal_processor
  • reviewboard.search.testing
  • reviewboard.site.conditions
  • reviewboard.site.context_processors
  • reviewboard.site.decorators
  • reviewboard.site.middleware
  • reviewboard.site.mixins
  • reviewboard.site.models
  • reviewboard.site.signals
  • reviewboard.site.templatetags.localsite
  • reviewboard.site.testing
  • reviewboard.site.testing.queries
  • reviewboard.site.urlresolvers
  • reviewboard.site.validation
  • reviewboard.ssh.client
  • reviewboard.ssh.errors
  • reviewboard.ssh.policy
  • reviewboard.ssh.storage
  • reviewboard.ssh.utils
  • reviewboard.testing.hosting_services
  • reviewboard.testing.queries
  • reviewboard.testing.queries.base
  • reviewboard.testing.queries.http
  • reviewboard.testing.scmtool
  • reviewboard.testing.testcase
  • reviewboard.themes
  • reviewboard.themes.context_processors
  • reviewboard.themes.ui
  • reviewboard.themes.ui.base
  • reviewboard.themes.ui.default
  • reviewboard.themes.ui.registry
  • reviewboard.webapi.auth_backends
  • reviewboard.webapi.base
  • reviewboard.webapi.decorators
  • reviewboard.webapi.errors
  • reviewboard.webapi.mixins
  • reviewboard.webapi.models
  • reviewboard.webapi.server_info
  • reviewboard.webapi.testing
  • reviewboard.webapi.testing.queries
  • reviewboard.webapi.tests.base
  • Frequently Asked Questions
  • General Index
  • Python Module Index
  • Release Notes
  • reviewboard.testing.testcase¶

    Base test case support for Review Board.

    class TestCase(methodName='runTest')[source]¶

    Bases: FixturesCompilerMixin, TestCase

    The base class for Review Board test cases.

    This class provides a number of convenient functions for creating common objects for testing, such as review requests and comments. They’re populated with default data that can be overridden by the callers.

    This also overcomes an annoyance with default Django unit tests where the cache is not cleared across tests, leading to inconsistent results and useless testing.

    local_site_name = 'local-site-1'[source]¶
    local_site_id = 1[source]¶
    maxDiff = 1000000[source]¶
    ws_re = re.compile('\\s+')[source]¶
    DEFAULT_FILEDIFF_DATA_DIFF = b'--- README\trevision 123\n+++ README\trevision 123\n@@ -1 +1 @@\n-Hello, world!\n+Hello, everybody!\n'[source]¶
    DEFAULT_GIT_FILEDIFF_DATA_DIFF = b'diff --git a/README b/README\nindex 94bdd3e..197009f 100644\n--- README\n+++ README\n@@ -2 +2 @@\n-blah blah\n+blah!\n'[source]¶
    DEFAULT_GIT_README_DIFF = b'diff --git a/readme b/readme\nindex d6613f5..5b50866 100644\n--- a/readme\n+++ b/readme\n@@ -1 +1,3 @@\nHello there\n+\n+Oh hi!\n'[source]¶
    DEFAULT_GIT_FILEMODE_DIFF = b'diff --git a/testing b/testing\nold mode 100755\nnew mode 100644\nindex e69de29..bcae657\n--- a/testing\n+++ b/testing\n@@ -0,0 +1 @@\n+ADD\ndiff --git a/testing2 b/testing2\nold mode 100644\nnew mode 100755\n'[source]¶
    DEFAULT_GIT_FILE_NOT_FOUND_DIFF = b'diff --git a/missing-file b/missing-file\nindex d6613f0..5b50866 100644\n--- a/missing-file\n+++ b/missing-file\n@@ -1 +1,3 @@\nHello there\n+\n+Oh hi!\n'[source]¶
    DEFAULT_GIT_BINARY_IMAGE_DIFF = b'diff --git a/logo.png b/logo.png\nindex 86b520c..86b520d\nBinary files a/logo.png and b/logo.png differ\n'[source]¶
    classmethod setUpClass()[source]¶

    Set up the test class.

    classmethod tearDownClass()[source]¶

    Tear down the test class.

    setUp()[source]¶

    Hook method for setting up the test fixture before exercising it.

    load_fixtures(fixtures, **kwargs)[source]¶

    Load data from fixtures.

    If the legacy test_scmtools fixture is used, the SCMTools registry will re-synchronize with the database, adding any missing tools.

    Parameters:
    • fixtures (list of str) – The list of fixtures to load.

    • **kwargs (dict) – Additional keyword arguments to pass to the parent method.

    shortDescription()[source]¶

    Returns the description of the current test.

    This changes the default behavior to replace all newlines with spaces, allowing a test description to span lines. It should still be kept short, though.

    get_local_site_or_none(name: Optional[str]) → Optional[LocalSite][source]¶

    Return a LocalSite matching the name, if provided, or None.

    Parameters:

    name (str) – The name of the Local Site.

    Returns:

    The Local Site, or None if name is None.

    Return type:

    reviewboard.site.models.LocalSite

    Raises:

    django.core.exceptions.ObjectDoesNotExist – The Local Site was specified but could not be found.

    get_local_site(name: str) → LocalSite[source]¶

    Return a LocalSite matching the name, if provided.

    The Local Site will be cached for future lookups in the test.

    Parameters:

    name (str) – The name of the Local Site.

    Returns:

    The Local Site.

    Return type:

    reviewboard.site.models.LocalSite

    Raises:

    django.core.exceptions.ObjectDoesNotExist – The Local Site could not be found.

    create_local_site(name: str = 'local-site-1', *, users: Sequence[User] = [], admins: Sequence[User] = [], **kwargs) → LocalSite[source]¶

    Create a LocalSite for testing.

    To maintain compatibility with the behavior of the test_site fixture, this will cache the created LocalSite for use in get_local_site().

    Changed in version 5.0.7:

    • Added users and admins arguments.

    New in version 5.0.

    Parameters:
    • name (str, optional) – The local site name. This defaults to local_site_name.

    • users (list of django.contrib.auth.models.User, optional) –

      A list of users to add to the site.

      New in version 5.0.7.

    • admins (list of django.contrib.auth.models.User, optional) –

      A list of users to add to the site’s list of administrators.

      New in version 5.0.7.

    • **kwargs (dict) – Keyword arguments to be passed to the LocalSite initializer.

    Returns:

    The resulting LocalSite.

    Return type:

    reviewboard.site.models.LocalSite

    create_http_request(path: str = '/', user: Optional[Union[AnonymousUser, User]] = None, method: str = 'get', with_local_site: bool = False, local_site: Optional[LocalSite] = None, resolver_match: Optional[ResolverMatch] = None, view: Optional[Callable[[...], Any]] = None, url_name: Optional[str] = None, **kwargs) → HttpRequest[source]¶

    Create an HttpRequest for testing.

    This wraps RequestFactory, automatically handing some common fields normally set by middleware, including the user, resolver match, and Local Site.

    Changed in version 6.0: Added the url_name parameter.

    Parameters:
    • path (str, optional) – The path for the HTTP request, relative to the server root.

    • user (django.contrib.auth.models.User, optional) – The user authenticated for the request. If not provided, AnonymousUser will be used.

    • method (str, optional) – The method on RequestFactory used to create the request.

    • with_local_site (bool, optional) – If set, the default Local Site will be assigned to the request, if local_site is not provided in the call.

    • local_site (reviewboard.site.models.LocalSite, optional) – The Local Site to assign to the request.

    • resolver_match (django.urls.ResolverMatch, optional) – A custom resolver match to set for the request. This may be used by views to determine which URL entry was invoked. If not provided, a blank one pointing to the provided view will be used.

    • view (callable, optional) – The view used for a default ResolverMatch.

    • url_name (str, optional) –

      The URL name to set in the resolver match, when creating one. If resolver_match is passed in, this will not be used.

      New in version 6.0.

    • **kwargs (dict) – Additional keyword arguments to pass to the request factory method.

    Returns:

    The resulting HTTP request.

    Return type:

    django.http.HttpRequest

    Raises:

    ValueError – One or more of the values provided was invalid.

    create_user(username: str = 'test-user', password: str = '', email: str = 'test@example.com', perms: Optional[Sequence[Tuple[str, str]]] = None, **kwargs) → User[source]¶

    Create a User for testing.

    Parameters:
    • username (str, optional) – The username.

    • password (str, optional) – The user’s password.

    • email (str, optional) – The user’s e-mail address.

    • perms (list of tuple, optional) – A list of permissions to assign. Each item is a tuple of (app_label, permission_name).

    • **kwargs (dict) – Additional attributes for the user.

    Returns:

    The new User object.

    Return type:

    django.contrib.auth.models.User

    create_webapi_token(user: User, note: str = 'Sample note', policy: JSONDict = {'access': 'rw'}, with_local_site: bool = False, token_generator_id: Optional[str] = None, token_info: JSONDict = {'token_type': 'rbp'}, local_site: Optional[LocalSite] = None, **kwargs) → WebAPIToken[source]¶

    Create a WebAPIToken for testing.

    Changed in version 5.0:

    • Added the local_site, token_generator_id and token_info parameters. The latter are used to specify the type of token to generate.

    Parameters:
    • user (django.contrib.auth.models.User) – The user who owns the token.

    • note (str, optional) – A note describing the token.

    • policy (dict, optional) – The policy document describing what this token can access in the API.

    • with_local_site (bool, optional) –

      Whether to create the repository using a Local Site. This will choose one based on local_site_name.

      If local_site is provided, this argument is ignored.

    • token_generator_id (str, optional) –

      The ID of the token generator to use for generating the token. If not set this will use the default token generator that is defined in the token generator registry.

      New in version 5.0.

    • token_info (dict, optional) –

      A dictionary that contains information needed for token generation. If not set this will default to a dictionary that contains a token_type value.

      New in version 5.0.

    • local_site (reviewboard.site.models.LocalSite, optional) –

      The explicit Local Site to attach.

      New in version 5.0.

    • **kwargs (dict) – Keyword arguments to be passed to generate_token().

    Returns:

    The WebAPIToken that was created.

    Return type:

    reviewboard.webapi.models.WebAPIToken

    assertQueries(queries: Sequence[Union[ExpectedQuery, Dict[str, Any]]], num_statements: Optional[int] = None, *, with_tracebacks: bool = False, traceback_size: int = 15, check_join_types: Optional[bool] = True, check_subqueries: Optional[bool] = True) → Iterator[None][source]¶

    Assert the number and complexity of queries.

    This is a wrapper around assertQueries() in Djblets that forces an opt-in to checking join types and subqueries.

    This wrapper can go away when those are enabled by default.

    New in version 5.0.7.

    Parameters:
    • queries (list of ExpectedQuery) – The list of query dictionaries to compare executed queries against.

    • num_statements (int, optional) –

      The number of SQL statements executed.

      This defaults to the length of queries, but callers may need to provide an explicit number, as some operations may add additional database-specific statements (such as transaction-related SQL) that won’t be covered in queries.

    • with_tracebacks (bool, optional) – If enabled, tracebacks for queries will be included in results.

    • tracebacks_size (int, optional) –

      The size of any tracebacks, in number of lines.

      The default is 15.

    • check_join_types (bool, optional) –

      Whether to check join types.

      If enabled, table join types (join_types on queries) will be checked. This is currently disabled by default, in order to avoid breaking tests, but will be enabled by default in Djblets 5.

    • check_subqueries (bool, optional) –

      Whether to check subqueries.

      If enabled, inner_query on queries with subqueries will be checked. This is currently disabled by default, in order to avoid breaking tests, but will be enabled by default in Djblets 5.

    Raises:

    AssertionError – The parameters passed, or the queries compared, failed expectations.

    assert_warns(cls: ~typing.Type[DeprecationWarning] = <class 'DeprecationWarning'>, message: ~typing.Optional[str] = None) → Iterator[None][source]¶

    A context manager for asserting code generates a warning.

    This will check that the code ran in the context will generate a warning with the given class and message. If the call generates multiple warnings, each will be checked.

    Parameters:
    • cls (type, optional) – The type of warning that should be generated.

    • message (str, optional) – The message that should be generated in the warning.

    Context:

    The code to run that’s expected to generate a warning.

    create_diff_file_attachment(filediff: FileDiff, from_modified: bool = True, review_request: Optional[ReviewRequest] = None, orig_filename: str = 'filename.png', caption: str = 'My Caption', mimetype: str = 'image/png', **kwargs) → FileAttachment[source]¶

    Create a diff-based FileAttachment for testing.

    The FileAttachment is tied to the given FileDiff. It’s populated with default data that can be overridden by the caller.

    Parameters:
    • filediff (reviewboard.diffviewer.models.filediff.FileDiff) – The FileDiff that the attachment is associated with.

    • from_modified (bool, optional) – Whether this file attachment is associated with the modified version of the file.

    • review_request (reviewboard.reviews.models.review_request.ReviewRequest, optional) – The optional review request that owns this file attachment.

    • orig_filename (str, optional) – The original filename as shown in the diff.

    • caption (str, optional) – The caption of the file.

    • mimetype (str, optional) – The file’s mimetype.

    • **kwargs (dict) – Additional model attributes to set on the file attachment.

    Returns:

    The newly-created file attachment.

    Return type:

    reviewboard.attachments.models.FileAttachment

    create_diffcommit(repository: Optional[Repository] = None, diffset: Optional[DiffSet] = None, commit_id: str = 'r1', parent_id: str = 'r0', diff_contents: bytes = b'diff --git a/README b/README\nindex 94bdd3e..197009f 100644\n--- README\n+++ README\n@@ -2 +2 @@\n-blah blah\n+blah!\n', parent_diff_contents: Optional[bytes] = None, author_name: str = 'Author', author_email: str = 'author@example.com', author_date: Optional[datetime] = None, commit_message: str = 'Commit message', committer_name: str = 'Committer', committer_email: str = 'committer@example.com', committer_date: Optional[datetime] = None, with_diff: bool = True, extra_data: Optional[JSONDict] = None, **kwargs) → DiffCommit[source]¶

    Create a DiffCommit for testing.

    By default, this also parses the provided diff data and creates a reviewboard.diffviewer.models.filediff.FileDiff attached to the commit. Callers can turn this off using with_diff=False.

    Changed in version 4.0.5: Added the with_diff and extra_data options.

    Parameters:
    • repository (reviewboard.scmtools.models.Repository, optional) – The repository the commit is associated with.

    • diffset (reviewboard.diffviewer.models.diffset.DiffSet, optional) – The parent diffset.

    • commit_id (str, optional) – The commit ID.

    • parent_id (str, optional) – The commit ID of the parent commit.

    • diff_contents (bytes, optional) – The contents of the diff.

    • parent_diff_contents (bytes, optional) – The contents of the parent diff, if any.

    • author_name (str, optional) – The name of the commit’s author.

    • author_email (str, optional) – The e-mail address of the commit’s author.

    • author_date (datetime.datetime, optional) – The date the commit was authored.

    • commit_message (str, optional) – The commit message.

    • committer_name (str, optional) – The name of the committer, if any.

    • committer_email (str, optional) – The e-mail address of the committer, if any.

    • committer_date (datetime.datetime, optional) – The date the commit was committed, if any.

    • with_diff (bool, optional) –

      Whether to create this with a diff.

      If True (the default), this will also create a FileDiff based on diff_contents and parent_diff_contents. The diffs will be parsed using the repository’s tool’s native parser in order to create the commit.

      If False, this will just create the object in the database.

    • extra_data (dict, optional) – Explicit extra_data to attach to the commit.

    • **kwargs (dict) – Keyword arguments to be passed to the DiffCommit initializer.

    Returns:

    The resulting DiffCommit.

    Return type:

    reviewboard.diffviewer.models.diffcommit.DiffCommit

    create_diffset(review_request: Optional[ReviewRequest] = None, revision: int = 1, repository: Optional[Repository] = None, draft: bool = False, name: str = 'diffset', **kwargs) → DiffSet[source]¶

    Create a DiffSet for testing.

    The DiffSet defaults to revision 1. This can be overridden by the caller.

    DiffSets generally are tied to a ReviewRequest, but it’s optional.

    Parameters:
    • review_request (reviewboard.reviews.models.review_request.ReviewRequest, optional) – The only review request that owns the DiffSet.

    • revision (int, optional) – The revision of the DiffSet.

    • repository (reviewboard.scmtools.models.Repository, optional) – The repository that backs files in the DiffSet.

    • draft (bool, optional) – Whether this is a draft DiffSet.

    • name (str, optional) – The name of the DiffSet.

    • **kwargs (dict) – Additional model attributes to set on the DiffSet.

    Returns:

    The newly-created DiffSet.

    Return type:

    reviewboard.diffviewer.models.diffset.DiffSet

    create_diff_comment(review: Review, filediff: FileDiff, interfilediff: Optional[FileDiff] = None, text: str = 'My comment', issue_opened: bool = False, issue_status: Optional[str] = None, first_line: int = 1, num_lines: int = 5, extra_fields: Optional[JSONDict] = None, reply_to: Optional[Comment] = None, timestamp: Optional[datetime] = None, **kwargs) → Comment[source]¶

    Create a Comment for testing.

    The comment is tied to the given Review and FileDiff (and, optionally, an interfilediff). It’s populated with default data that can be overridden by the caller.

    Parameters:
    • review (reviewboard.reviews.models.review.Review) – The review associated with the comment.

    • filediff (reviewboard.diffviewer.models.filediff.FileDiff) – The FileDiff associated with the comment.

    • interfilediff (reviewboard.diffviewer.models.filediff.FileDiff, optional) – The FileDiff used for the end of an interdiff range associated with the comment.

    • text (str) – The text for the comment.

    • issue_opened (bool, optional) – Whether an issue is to be opened for the comment.

    • issue_status (str, optional) – The issue status to set, if an issue is opened. Defaults to being an open issue.

    • first_line (int, optional) – The first line (0-based) of the comment range.

    • num_lines (int, optional) – The number of lines in the comment.

    • extra_fields (dict, optional) – Extra data to set on the comment.

    • reply_to (reviewboard.reviews.models.diff_comment.Comment, optional) – The comment this comment replies to.

    • timestamp (datetime.datetime, optional) –

      The timestamp for the comment.

      New in version 5.0.

    • **kwargs (dict) – Additional model attributes to set on the comment.

    Returns:

    The resulting comment.

    Return type:

    reviewboard.reviews.models.diff_comment.Comment

    create_file_attachment(review_request: ReviewRequest, attachment_history: Optional[FileAttachmentHistory] = None, draft: Union[ReviewRequestDraft, bool] = False, active: bool = True, with_history: bool = True, **kwargs) → FileAttachment[source]¶

    Create a FileAttachment for testing.

    The attachment is tied to the given ReviewRequest. It’s populated with default data that can be overridden by the caller.

    Changed in version 6.0: Added the with_history parameter.

    Parameters:
    • review_request (reviewboard.reviews.models.review_request.ReviewRequest) – The review request that ultimately owns the file attachment.

    • attachment_history (reviewboard.attachments.models.FileAttachmentHistory, optional) – An attachment history managing the file attachment.

    • draft (bool or :class:`` :class:`` :class:`` :class:`` :class:`` :class:`` :class:`` :class:`` :class:`` :class:`` :class:`` reviewboard.reviews.models.review_request_draft.ReviewRequestDraft, optional) – A draft to associate the attachment with. This can also be a boolean, for legacy reasons, which will attempt to look up or create a draft for the review request.

    • active (bool, optional) – Whether this attachment is considered active (not deleted).

    • with_history (bool, optional) –

      Whether to create a FileAttachmentHistory for this file attachment. If attachment_history is supplied, that attachment history will be used instead.

      This defaults to True.

      New in version 6.0.

    • **kwargs (dict) – Additional keyword arguments to pass to create_file_attachment_base().

    Returns:

    The resulting file attachment.

    Return type:

    reviewboard.attachments.models.FileAttachment

    create_user_file_attachment(user: User, has_file: bool = False, **kwargs) → FileAttachment[source]¶

    Create a user FileAttachment for testing.

    The reviewboard.attachments.models.FileAttachment is tied to the given django.contrib.auth.models.User. It’s populated with default data that can be overridden by the caller. Notably, by default the FileAttachment will be created without a file or a local_site.

    Parameters:
    • user (django.contrib.auth.models.User) – The user who owns the file attachment.

    • has_file (bool, optional) – True if an actual file object should be included in the model. This is False by default.

    • **kwargs (dict) – Additional keyword arguments to pass to create_file_attachment_base().

    Returns:

    The new file attachment instance.

    Return type:

    reviewboard.attachments.models.FileAttachment

    create_file_attachment_comment(review: Review, file_attachment: FileAttachment, diff_against_file_attachment: Optional[FileAttachment] = None, text: str = 'My comment', issue_opened: bool = False, issue_status: Optional[str] = None, extra_fields: Optional[JSONDict] = None, reply_to: Optional[FileAttachmentComment] = None, timestamp: Optional[datetime] = None, **kwargs) → FileAttachmentComment[source]¶

    Create a FileAttachmentComment for testing.

    The comment is tied to the given Review and FileAttachment. It’s populated with default data that can be overridden by the caller.

    Parameters:
    • review (reviewboard.reviews.models.review.Review) – The review associated with the comment.

    • file_attachment (reviewboard.attachments.models.FileAttachment) – The file attachment associated with the comment.

    • diff_against_file_attachment (reviewboard.attachments.models.FileAttachment, optional) – The file attachment being diff against, for comments on attachment diffs.

    • text (str, optional) – The text for the comment.

    • issue_opened (bool, optional) – Whether an issue is to be opened for the comment.

    • issue_status (str, optional) – The issue status to set, if an issue is opened. Defaults to being an open issue.

    • extra_fields (dict, optional) – Extra data to set on the comment.

    • reply_to (reviewboard.reviews.models.file_attachment_comment.FileAttachmentComment, optional) – The comment this comment replies to.

    • timestamp (datetime.datetime, optional) –

      The timestamp for the comment.

      New in version 5.0.

    • **kwargs (dict) – Additional model attributes to set on the comment.

    Returns:

    The resulting comment.

    Return type:

    reviewboard.reviews.models.file_attachment_comment.FileAttachmentComment

    create_file_attachment_history(review_request: Optional[ReviewRequest] = None, display_position: Optional[int] = None, **kwargs) → FileAttachmentHistory[source]¶

    Create a FileAttachmentHistory for testing.

    Parameters:
    • review_request (reviewboard.reviews.models.review_request.ReviewRequest, optional) – The optional review request to attach the history to.

    • display_position (int, optional) – The display position on the review request. If not provided, a proper position will be computed.

    • **kwargs (dict) – Additional fields to set on the model.

    Returns:

    The new file attachment instance.

    Return type:

    reviewboard.attachments.models.FileAttachmentHistory

    create_filediff(diffset: DiffSet, source_file: str = '/test-file', dest_file: str = '/test-file', source_revision: RevisionID = '123', dest_detail: str = '124', status: str = 'M', diff: bytes = b'--- README\trevision 123\n+++ README\trevision 123\n@@ -1 +1 @@\n-Hello, world!\n+Hello, everybody!\n', commit: Optional[DiffCommit] = None, encoding: Optional[str] = None, save: bool = True, **kwargs) → FileDiff[source]¶

    Create a FileDiff for testing.

    The FileDiff is tied to the given DiffSet. It’s populated with default data that can be overridden by the caller.

    Parameters:
    • diffset (reviewboard.diffviewer.models.diffset.DiffSet) – The parent diff set that will own this file.

    • source_file (str, optional) – The source filename.

    • dest_file (str, optional) – The destination filename, which will be the same as source_file unless the file was moved/renamed/copied.

    • source_revision (str, optional) – The source revision.

    • dest_detail (str, optional) – The destination revision or other detail as found in the parsed diff. This may be a timestamp or some other value.

    • status (str, optional) – The status of the file. This is the operation performed as indicated in the diff.

    • diff (bytes, optional) – The diff contents.

    • commit (reviewboard.diffviewer.models.diffcommit.DiffCommit, optional) – The commit to attach the FileDiff to.

    • encoding (str, optional) – An explicit encoding to set for the file.

    • save (bool, optional) – Whether to automatically save the resulting object.

    • **kwargs (dict) –

      Additional fields to set on the model.

      New in version 4.0.5.

    Returns:

    The resulting FileDiff.

    Return type:

    reviewboard.diffviewer.models.filediff.FileDiff

    create_repository(with_local_site: bool = False, name: str = 'Test Repo', tool_name: str = 'Git', path: Optional[str] = None, local_site: Optional[LocalSite] = None, extra_data: Optional[JSONDict] = None, *, users: Sequence[User] = [], review_groups: Sequence[Group] = [], **kwargs) → Repository[source]¶

    Create a Repository for testing.

    The Repository may optionally be attached to a LocalSite. It’s also populated with default data that can be overridden by the caller.

    Changed in version 5.0.7:

    • Added users and review_groups arguments.

    Parameters:
    • with_local_site (bool, optional) –

      Whether to create the repository using a Local Site. This will choose one based on local_site_name.

      If local_site is provided, this argument is ignored.

    • name (str, optional) – The name of the repository.

    • tool_name (str, optional) – The name of the registered SCM Tool for the repository.

    • path (str, optional) – The path for the repository. If not provided, one will be computed.

    • local_site (reviewboard.site.models.LocalSite, optional) – The explicit Local Site to attach.

    • extra_data (dict, optional) – Explicit extra_data to attach to the repository.

    • users (list of django.contrib.auth.models.User, optional) –

      A list of users to add to the repository.

      New in version 5.0.7.

    • review_groups (list of reviewboard.reviews.models.group.Group) –

      A list of review groups to add to the repository.

      New in version 5.0.7.

    • **kwargs (dict) – Additional fields to set on the repository.

    Returns:

    The new repository.

    Return type:

    reviewboard.scmtools.models.Repository

    create_review_request(with_local_site: bool = False, create_repository: bool = False, create_with_history: bool = False, publish: bool = False, id: Optional[int] = None, local_id: Optional[int] = 1001, local_site: Optional[LocalSite] = None, repository: Optional[Repository] = None, time_added: Optional[datetime] = None, last_updated: Optional[datetime] = None, status: str = 'P', submitter: Union[str, User] = 'doc', summary: str = 'Test Summary', description: str = 'Test Description', testing_done: Optional[str] = 'Testing', branch: Optional[str] = 'my-branch', depends_on: Optional[Sequence[ReviewRequest]] = None, target_people: Optional[Sequence[User]] = None, target_groups: Optional[Sequence[Group]] = None, **kwargs) → ReviewRequest[source]¶

    Create a ReviewRequest for testing.

    The ReviewRequest may optionally be attached to a LocalSite. It’s also populated with default data that can be overridden by the caller.

    Parameters:
    • with_local_site (bool, optional) –

      Whether to create this review request on a default local site.

      This is ignored if local_site is provided.

    • create_repository (bool, optional) –

      Whether to create a new repository in the database for this review request.

      This can’t be set if repository is provided.

    • create_with_history (bool, optional) – Whether or not the review request should support multiple commits.

    • publish (bool, optional) – Whether to publish the review request after creation.

    • id (int, optional) – An explicit database ID to set for the review request.

    • local_id (int, optional) – The ID specific to the local site, if one is used.

    • local_site (reviewboard.site.models.LocalSite, optional) –

      The LocalSite to associate the review request with.

      If not provided, the LocalSite with the name specified in local_site_name will be used.

    • repository (reviewboard.scmtools.models.Repository, optional) – An explicit repository to set for the review request.

    • time_added (datetime.datetime, optional) – An explicit creation timestamp to set for the review request.

    • last_updated (datetime.datetime, optional) – An explicit last updated timestamp to set for the review request.

    • status (str, optional) – The status of the review request. This must be one of the values listed in STATUSES.

    • submitter (str or django.contrib.auth.models.User, optional) – The submitter of the review request. This can be a username (which will be looked up) or an explicit user.

    • summary (str, optional) – The summary for the review request.

    • description (str, optional) – The description for the review request.

    • testing_done (str, optional) – The Testing Done text for the review request.

    • branch (str, optional) – The branch for the review request.

    • depends_on (list of reviewboard.reviews.models.review_request.ReviewRequest, optional) – A list of review requests to set as dependencies.

    • target_people (list of django.contrib.auth.models.User, optional) – A list of users to set as target reviewers.

    • target_groups (list of reviewboard.reviews.models.group.Group, optional) – A list of review groups to set as target reviewers.

    • **kwargs (dict) – Additional fields to set on the review request.

    Returns:

    The resulting review request.

    Return type:

    reviewboard.reviews.models.review_request.ReviewRequest

    Raises:

    ValueError – An invalid value was provided during initialization.

    create_many_review_requests(count: int, with_local_site: bool = False, create_repository: bool = False, create_with_history: bool = True, start_id: Optional[int] = None, start_local_id: Optional[int] = 1001, local_site: Optional[LocalSite] = None, repository: Optional[Repository] = None, public: bool = False, status: str = 'P', submitter: Union[str, User] = 'doc', summary: str = 'Test Summary %s', description: str = 'Test Description %s', testing_done: str = 'Testing %s', branch: Optional[str] = 'my-branch', depends_on: Optional[Sequence[ReviewRequest]] = None, target_people: Optional[Sequence[User]] = None, target_groups: Optional[Sequence[Group]] = None, **kwargs) → List[ReviewRequest][source]¶

    Batch-create multiple ReviewRequests for testing.

    This will execute the minimum number of SQL statements needed to add the requested amount of review requests to the database.

    Due to the nature of this method, not every operation supported by create_review_request() is supported here.

    New in version 5.0.

    Parameters:
    • count (int) – The number of review requests to create.

    • with_local_site (bool, optional) –

      Whether to create the review requests on a default local site.

      This is ignored if local_site is provided.

    • create_repository (bool, optional) –

      Whether to create a new repository in the database, shared by all created review requests.

      This can’t be set if repository is provided.

    • create_with_history (bool, optional) –

      Whether or not the review requests should all support multiple commits.

      Note that unlike create_review_request(), this defaults to True.

    • start_id (int, optional) – An explicit database ID to start with for the new review requests.

    • start_local_id (int, optional) – The LocalSite-specific ID to use as the start for the new review requests.

    • local_site (reviewboard.site.models.LocalSite, optional) –

      The LocalSite to associate the review requests with.

      If not provided, the LocalSite with the name specified in local_site_name will be used, if using with_local_site.

    • repository (reviewboard.scmtools.models.Repository, optional) – An explicit repository to set for the review request.

    • public (bool, optional) – Whether to mark each review request as public.

    • status (str, optional) – The status of the review requests. This must be one of the values listed in STATUSES.

    • submitter (str or django.contrib.auth.models.User, optional) – The submitter of the review requests. This can be a username (which will be looked up) or an explicit user.

    • summary (str, optional) –

      The summary for the review request.

      This must contains a %s, which will be replaced with the 1-based index of the review request.

    • description (str, optional) –

      The description for the review request.

      This must contains a %s, which will be replaced with the 1-based index of the review request.

    • testing_done (str, optional) –

      The Testing Done text for the review request.

      This must contains a %s, which will be replaced with the 1-based index of the review request.

    • branch (str, optional) – The branch for the review request.

    • depends_on (list of reviewboard.reviews.models.review_request.ReviewRequest, optional) – A list of review requests to set as dependencies for each review request.

    • target_people (list of django.contrib.auth.models.User, optional) – A list of users to set as target reviewers for each review request.

    • target_groups (list of reviewboard.reviews.models.group.Group, optional) – A list of review groups to set as target reviewers for each review request.

    • **kwargs (dict) –

      Additional fields to set on each review request.

      Note that not all fields can necessarily be set, and some may have side effects.

    Returns:

    The list of resulting review requests.

    Return type:

    list of reviewboard.reviews.models.review_request.ReviewRequest

    Raises:

    ValueError – An invalid value was provided during initialization.

    create_review_request_draft(review_request: ReviewRequest, **kwargs) → ReviewRequestDraft[source]¶

    Create a ReviewRequestDraft for testing.

    Parameters:
    • review_request (reviewboard.reviews.models.review_request.ReviewRequest) – The review request for the draft.

    • **kwargs (dict) –

      Additional fields to set on the review request draft.

      New in version 4.0.5.

    Returns:

    The newly-created draft.

    Return type:

    reviewboard.reviews.models.review_request_draft.ReviewRequestDraft

    create_visit(review_request: ReviewRequest, visibility: str, user: Union[str, User] = 'doc', timestamp: Optional[datetime] = None, **kwargs) → ReviewRequestVisit[source]¶

    Create a ReviewRequestVisit for testing.

    The ReviewRequestVisit is tied to the given ReviewRequest and User. It’s populated with default data that can be overridden by the caller.

    The provided user may either be a username or a User object.

    Changed in version 5.0.7:

    • timestamp and user are now processed and set correctly.

    Parameters:
    • review_request (reviewboard.reviews.models.review_request.ReviewRequest) – The review request that was visited.

    • visibility (str) – The visibility state for the visit.

    • user (str or django.contrib.auth.models.User) – The user that visited the review request.

    • timestamp (datetime.datetime, optional) – The timestamp of the visit.

    • **kwargs (dict) – Additional fields to set on the visit.

    Returns:

    The newly-created visit object.

    Return type:

    reviewboard.accounts.models.ReviewRequestVisit

    create_review(review_request: ReviewRequest, user: Union[str, User] = 'dopey', body_top: Optional[str] = 'Test Body Top', body_bottom: Optional[str] = 'Test Body Bottom', ship_it: bool = False, publish: bool = False, timestamp: Optional[datetime] = None, **kwargs) → Review[source]¶

    Create a Review for testing.

    The Review is tied to the given ReviewRequest. It’s populated with default data that can be overridden by the caller.

    The provided user may either be a username or a User object.

    If publish is True, Review.publish() will be called.

    Parameters:
    • review_request (reviewboard.reviews.models.review_request.ReviewRequest) – The review request the review is filed against.

    • user (str or django.contrib.auth.models.User, optional) – The username or User object owning the review.

    • body_top (str, optional) – The text for the body_top field.

    • body_bottom (str, optional) – The text for the body_bottom field.

    • ship_it (bool, optional) – The Ship It state for the review.

    • publish (bool, optional) – Whether to publish the review immediately after creation.

    • timestamp (datetime.datetime, optional) – The timestamp for the review.

    • **kwargs (dict) – Additional attributes to set in the review.

    Returns:

    The resulting review.

    Return type:

    reviewboard.reviews.models.review.Review

    create_review_group(name: str = 'test-group', with_local_site: bool = False, local_site: Optional[LocalSite] = None, visible: bool = True, invite_only: bool = False, is_default_group: bool = False, *, users: Sequence[User] = [], **kwargs) → Group[source]¶

    Create a review group for testing.

    The group may optionally be attached to a LocalSite. It’s also populated with default data that can be overridden by the caller.

    Changed in version 5.0.7:

    • Added users arguments.

    Parameters:
    • name (str, optional) – The name of the review group.

    • with_local_site (bool, optional) –

      Whether to create the repository using a Local Site. This will choose one based on local_site_name.

      If local_site is provided, this argument is ignored.

    • local_site (reviewboard.site.models.LocalSite, optional) – The explicit Local Site to attach.

    • visible (bool, optional) – Whether the review group should be visible.

    • invite_only (bool, optional) – Whether the review group should be invite-only.

    • is_default_group (bool, optional) – Whether this review group is a default for new users.

    • users (list of django.contrib.auth.models.User, optional) –

      A list of users to add to the review group.

      New in version 5.0.7.

    create_reply(review: Review, user: Union[str, User] = 'grumpy', body_top: Optional[str] = 'Test Body Top', timestamp: Optional[datetime] = None, publish: bool = False, **kwargs) → Review[source]¶

    Create a review reply for testing.

    The reply is tied to the given Review. It’s populated with default data that can be overridden by the caller.

    To reply to a body_top or body_bottom field, pass either body_top_reply_to= or body_bottom_reply_to= to this method. This will be passed to the review’s constructor.

    Parameters:
    • review (reviewboard.reviews.models.review.Review) – The review being replied to.

    • user (django.contrib.auth.models.User or str, optional) – Either the user model or the username of the user who is replying to the review.

    • body_top (str, optional) – The body top text.

    • timestamp (datetime.datetime, optional) – The timestamp of the review.

    • publish (bool, optional) – Whether the review should be published. By default it’s in draft form.

    • **kwargs (dict) –

      Additional arguments to pass to the Review constructor.

      New in version 4.0.5.

    Returns:

    The resulting review.

    Return type:

    reviewboard.reviews.models.review.Review

    create_screenshot(review_request: ReviewRequest, caption: str = 'My caption', draft: bool = False, active: bool = True, **kwargs) → Screenshot[source]¶

    Create a Screenshot for testing.

    The screenshot is tied to the given ReviewRequest. It’s populated with default data that can be overridden by the caller.

    Parameters:
    • review_request (reviewboard.reviews.models.review_request.ReviewRequest) – The review request that ultimately owns the screenshot.

    • caption (str, optional) – The caption to use for the screenshot.

    • draft (bool or :class:`` :class:`` :class:`` :class:`` :class:`` :class:`` :class:`` :class:`` :class:`` :class:`` :class:`` reviewboard.reviews.models.review_request_draft.ReviewRequestDraft) – A draft to associate the screenshot with. This can also be a boolean, for legacy reasons, which will attempt to look up or create a draft for the review request.

    • active (bool) – Whether this screenshot is considered active (not deleted).

    • **kwargs (dict) – Additional fields to set on the screenshot.

    Returns:

    The resulting screenshot.

    Return type:

    reviewboard.reviews.models.screenshot.Screenshot

    create_screenshot_comment(review: Review, screenshot: Screenshot, text: str = 'My comment', x: int = 1, y: int = 1, w: int = 5, h: int = 5, issue_opened: bool = False, issue_status: Optional[str] = None, extra_fields: Optional[JSONDict] = None, reply_to: Optional[ScreenshotComment] = None, timestamp: Optional[datetime] = None, **kwargs) → ScreenshotComment[source]¶

    Create a ScreenshotComment for testing.

    The comment is tied to the given Review and Screenshot. It’s It’s populated with default data that can be overridden by the caller.

    Parameters:
    • review (reviewboard.reviews.models.review.Review) – The review associated with the comment.

    • screenshot (reviewboard.reviews.models.screenshot.Screenshot) – The screenshot associated with the comment.

    • text (str) – The text for the comment.

    • x (int, optional) – The X location for the comment on the screenshot.

    • y (int, optional) – The Y location for the comment on the screenshot.

    • w (int, optional) – The width for the comment on the screenshot.

    • h (int, optional) – The height for the comment on the screenshot.

    • issue_opened (bool, optional) – Whether an issue is to be opened for the comment.

    • issue_status (str, optional) – The issue status to set, if an issue is opened. Defaults to being an open issue.

    • extra_fields (dict, optional) – Extra data to set on the comment.

    • reply_to (reviewboard.reviews.models.screenshot_comment.ScreenshotComment, optional) – The comment this comment replies to.

    • timestamp (datetime.datetime, optional) –

      The timestamp for the comment.

      New in version 5.0.

    • **kwargs (dict) – Additional model attributes to set on the comment.

    Returns:

    The resulting comment.

    Return type:

    reviewboard.reviews.models.screenshot_comment.ScreenshotComment

    create_file_attachment_base(caption: str = 'My Caption', orig_filename: str = 'logo.png', mimetype: str = 'image/png', uuid: Optional[str] = None, has_file: bool = True, file_content: Optional[bytes] = None, user: Optional[User] = None, with_local_site: bool = False, local_site_name: Optional[str] = None, local_site: Optional[LocalSite] = None, **kwargs) → FileAttachment[source]¶

    Base helper to create a FileAttachment object.

    When creating a reviewboard.attachments.models.FileAttachment that will be associated to a review request, a user and local_site should not be specified.

    This is not meant to be called directly by tests. Callers should generallly use one of:

    • create_file_attachment()

    • create_user_file_attachment()

    Parameters:
    • caption (str, optional) – The caption for the file attachment.

    • orig_filename (str, optional) – The original name of the file to set in the model.

    • mimetype (str, optional) – The mimetype of the file attachment.

    • uuid (str, optional) – The UUID used to prefix the filename and reference the file attachment.

    • has_file (bool, optional) –

      True if an actual file object should be included in the model.

      This will set the file content based on file_content, if one is provided. If not provided, the Review Board logo is used as the file content.

    • file_content (bytes, optional) – The file content. This is only set if passing has_file=True.

    • user (django.contrib.auth.models.User, optional) – The user who owns the file attachment.

    • with_local_site (bool, optional) – True if the file attachment should be associated with a local site. If this is set, one of local_site_name or local_site should be provided as well.

    • local_site_name (str, optional) – The name of the local site to associate this attachment with.

    • local_site (reviewboard.site.models.LocalSite, optional) – The local site to associate this attachment with.

    • kwargs (dict) – Additional keyword arguments to pass into the FileAttachment constructor.

    Returns:

    The new file attachment instance.

    Return type:

    reviewboard.attachments.models.FileAttachment

    create_general_comment(review: Review, text: str = 'My comment', issue_opened: bool = False, issue_status: Optional[str] = None, extra_fields: Optional[JSONDict] = None, reply_to: Optional[GeneralComment] = None, timestamp: Optional[datetime] = None, **kwargs) → GeneralComment[source]¶

    Create a GeneralComment for testing.

    The comment is tied to the given Review. It is populated with default data that can be overridden by the caller.

    Parameters:
    • review (reviewboard.reviews.models.review.Review) – The review associated with the comment.

    • text (str) – The text for the comment.

    • issue_opened (bool, optional) – Whether an issue is to be opened for the comment.

    • issue_status (str, optional) – The issue status to set, if an issue is opened. Defaults to being an open issue.

    • extra_fields (dict, optional) – Extra data to set on the comment.

    • reply_to (reviewboard.reviews.models.general_comment.GeneralComment, optional) – The comment this comment replies to.

    • timestamp (datetime.datetime, optional) –

      The timestamp for the comment.

      New in version 5.0.

    • **kwargs (dict) – Additional model attributes to set on the comment.

    Returns:

    The resulting comment.

    Return type:

    reviewboard.reviews.models.general_comment.GeneralComment

    create_status_update(review_request: ReviewRequest, user: Union[str, User] = 'dopey', service_id: str = 'service', summary: str = 'Status Update', state: str = 'P', review: Optional[Review] = None, change_description: Optional[ChangeDescription] = None, timestamp: Optional[datetime] = None, **kwargs) → StatusUpdate[source]¶

    Create a status update for testing.

    It is populated with default data that can be overridden by the caller.

    Parameters:
    • review_request (reviewboard.reviews.models.ReviewRequest) – The review request to associate with the new status update.

    • user (django.contrib.auth.models.User or str) – Either the user model or the username of the user who should own the status update.

    • service_id (str) – The ID to fill in for the new model.

    • summary (str) – The summary to fill in for the new model.

    • state (str) – The state for the new model. This must be one of the valid choices for the state field.

    • review (reviewboard.reviews.models.review.Review, optional) – The review associated with this status update.

    • change_description (reviewboard.changedescs.models.ChangeDescription, optional) – The change description for this status update.

    • timestamp (datetime.datetime) – The timestamp for the status update.

    • **kwargs (dict) –

      Additional fields to set on the status update model.

      New in version 4.0.5.

    Returns:

    The new status update.

    Return type:

    reviewboard.reviews.models.StatusUpdate

    create_webhook(enabled: bool = False, events: str = '*', url: str = 'http://example.com', encoding: str = 'application/json', use_custom_content: bool = False, custom_content: str = '', secret: str = '', apply_to: str = 'A', repositories: Optional[Sequence[Repository]] = None, with_local_site: bool = False, local_site: Optional[LocalSite] = None, extra_fields: Optional[JSONDict] = None, **kwargs) → WebHookTarget[source]¶

    Create a webhook for testing.

    It is populated with default data that can be overridden by the caller.

    Parameters:
    • enabled (bool) – Whether or not the webhook is enabled when it is created.

    • events (str) – A comma-separated list of events that the webhook will trigger on.

    • url (str) – The URL that requests will be made against.

    • encoding (str) – The encoding of the payload to send.

    • use_custom_content (bool) – Determines if custom content will be sent for the payload (if True) or if it will be auto-generated (if False).

    • custom_content (str) – The custom content to send when use_custom_content is True.

    • secret (str) – An HMAC secret to sign the payload with.

    • apply_to (str) – The types of repositories the webhook will apply to.

    • repositories (list) – A list of repositories that the webhook will be limited to if apply_to is WebHookTarget.APPLY_TO_SELECTED_REPOS.

    • with_local_site (bool) – Determines if this should be created with a local site.

    • local_site (reviewboard.site.models.LocalSite) – An optional local site. If with_local_site is True and this argument is None, the local site will be looked up.

    • extra_fields (dict) – Extra data to be imported into the webhook.

    • **kwargs (dict) –

      Additional keyword arguments to pass into the WebHookTarget constructor.

      New in version 4.0.5.

    Returns:

    A webhook constructed with the given arguments.

    Return type:

    WebHookTarget

    create_oauth_application(user: User, local_site: Optional[LocalSite] = None, with_local_site: bool = False, redirect_uris: str = 'http://example.com', authorization_grant_type: str = 'client-credentials', client_type: str = 'public', **kwargs) → Application[source]¶

    Create an OAuth application.

    Parameters:
    • user (django.contrib.auth.models.User) – The user whom is to own the application.

    • local_site (reviewboard.site.models.LocalSite, optional) – The LocalSite for the application to be associated with, if any.

    • redirect_uris (str, optional) – A whitespace-separated list of allowable redirect URIs.

    • authorization_grant_type (str, optional) – The grant type for the application.

    • client_type (str, optional) – The application client type.

    • **kwargs (dict) – Additional keyword arguments to pass to the Application initializer.

    Returns:

    The created application.

    Return type:

    reviewboard.oauth.models.Application

    create_oauth_token(application: Application, user: User, scope: str = '', expires: Optional[timedelta] = None, **kwargs) → AccessToken[source]¶

    Create an OAuth2 access token for testing.

    Parameters:
    • application (reviewboard.oauth.models.Application) – The application the token should be associated with.

    • user (django.contrib.auth.models.User) – The user who should own the token.

    • scope (str, optional) – The scopes of the token. This argument defaults to the empty scope.

    • expires (datetime.timedelta, optional) – How far into the future the token expires. If not provided, this argument defaults to one hour.

    • **kwargs (dict) –

      Additional keyword arguments to pass into the AccessToken constructor.

      New in version 4.0.5.

    Returns:

    The created access token.

    Return type:

    oauth2_provider.models.AccessToken

    create_certificate(*, hostname: str = 'example.com', port: int = 443, subject: ~typing.Union[~typing.Literal[<UnsetSymbol.UNSET: '<UNSET>'>], str] = 'Test Subject', issuer: ~typing.Union[~typing.Literal[<UnsetSymbol.UNSET: '<UNSET>'>], str] = 'Test Issuer', valid_from: ~typing.Optional[~typing.Union[~typing.Literal[<UnsetSymbol.UNSET: '<UNSET>'>], ~datetime.datetime]] = None, valid_through: ~typing.Optional[~typing.Union[~typing.Literal[<UnsetSymbol.UNSET: '<UNSET>'>], ~datetime.datetime]] = None, fingerprints: ~typing.Optional[~typing.Union[~typing.Literal[<UnsetSymbol.UNSET: '<UNSET>'>], ~reviewboard.certs.cert.CertificateFingerprints]] = None, cert_data: ~typing.Optional[bytes] = None, key_data: ~typing.Optional[bytes] = None, **kwargs) → Certificate[source]¶

    Return a Certificate for testing.

    This will be pre-populated with default signature data and values, if not otherwise specified.

    If cert_data is provided, then most arguments will be ignored in favor of the values in the certificate.

    New in version 6.0.

    Parameters:
    • hostname (str, optional) – The hostname that would serve the certificate.

    • port (int, optional) – The port on the host that would serve the certificate.

    • subject (str, optional) –

      The subject (usually the hostname) of the certificate.

      This can be UNSET to force loading from a cert_data (if provided).

    • issuer (str, optional) –

      The issuer of the certificate.

      This can be UNSET to force loading from a cert_data (if provided).

    • valid_from (datetime, optional) –

      The first date/time in which the certificate is valid.

      This must have a timezone associated with it.

      If not provided or None, a default timestamp of 2023-07-14 7:50:30 UTC will be used.

      This can be UNSET to force loading from a cert_data (if provided).

    • valid_through (datetime, optional) –

      The last date/time in which the certificate is valid.

      This must have a timezone associated with it.

      If not provided or None, a default timestamp of 3023-07-14 7:50:30 UTC will be used.

      This can be UNSET to force loading from a cert_data (if provided).

    • fingerprints (CertificateFingerprints, optional) –

      Fingerprints to set for the certificate.

      If not provided or None, default fingerprints will be created using create_certificate_fingerprints().

      This can be UNSET to force loading from a cert_data (if provided).

    • cert_data (bytes, optional) –

      PEM-formatted certificate data to load.

      If set, subject, issuer, valid_from, valid_through, and fingerprints arguments will be ignored.

    • key_data (bytes, optional) – PEM-formatted private key data to load.

    • **kwargs (dict) – Additional keyword arguments supported by the Certificate constructor.

    Returns:

    The new certificate instance.

    Return type:

    reviewboard.certs.cert.Certificate

    create_certificate_bundle(*, bundle_data: Optional[bytes] = None, **kwargs) → CertificateBundle[source]¶

    Return a CertificateBundle for testing.

    This will be pre-populated with default data, unless otherwise specified.

    New in version 6.0.

    Parameters:
    • bundle_data (bytes, optional) –

      Explicit bundle data to load.

      If a value is not specified or is None, a sample bundle will be used.

    • **kwargs (dict, optional) – Additional keyword arguments supported by the CertificateBundle constructor.

    Returns:

    The new fingerprints instance.

    Return type:

    reviewboard.certs.cert.CertificateFingerprints

    create_certificate_fingerprints(*, sha1: ~typing.Optional[~typing.Union[~typing.Literal[<UnsetSymbol.UNSET: '<UNSET>'>], str]] = UnsetSymbol.UNSET, sha256: ~typing.Optional[~typing.Union[~typing.Literal[<UnsetSymbol.UNSET: '<UNSET>'>], str]] = UnsetSymbol.UNSET, **kwargs) → CertificateFingerprints[source]¶

    Return a CertificateFingerprints for testing.

    This will be pre-populated with default SHA1 and SHA256 signatures, if custom signatures are not supplied.

    New in version 6.0.

    Parameters:
    • sha1 (str, optional) –

      An explicit SHA1 fingerprint to set, or None to unset.

      If a value is not specified, reviewboard.certs.tests.testcases.TEST_SHA1 will be set.

    • sha256 (str, optional) –

      An explicit SHA256 fingerprint to set, or None to unset.

      If a value is not specified, reviewboard.certs.tests.testcases.TEST_SHA256 will be set.

    • **kwargs (dict, optional) – Additional keyword arguments supported by the CertificateFingerprints constructor.

    Returns:

    The new fingerprints instance.

    Return type:

    reviewboard.certs.cert.CertificateFingerprints

    siteconfig_settings(settings: JSONDict, reload_settings: bool = True) → Iterator[None][source]¶

    Temporarily sets siteconfig settings for a test.

    Parameters:
    • settings (dict) – The new siteconfig settings to set.

    • reload_settings (bool, optional) – Whether to reload and recompute all settings, applying them to Django and other objects.

    Context:

    The current site configuration will contain the new settings for this test.

    __annotations__ = {}¶
    class BaseFileDiffAncestorTests(*args, **kwargs)[source]¶

    Bases: SpyAgency, TestCase

    A base test case that creates a FileDiff history.

    fixtures = ['test_scmtools', 'test_users'][source]¶
    set_up_filediffs() → None[source]¶

    Create a set of commits with history.

    __annotations__ = {}¶
    get_filediffs_by_details()[source]¶

    Return a mapping of FileDiff details to the FileDiffs.

    Returns:

    A mapping of FileDiff details to FileDiffs.

    Return type:

    dict

    Keep up with the latest Review Board releases, security updates, and helpful information.

    About
    News
    Demo
    RBCommons Hosting
    Integrations
    Happy Users
    Support Options
    Documentation
    FAQ
    User Manual
    RBTools
    Administration Guide
    Power Pack
    Release Notes
    Downloads
    Review Board
    RBTools
    Djblets
    Power Pack
    Package Store
    PGP Signatures
    Contributing
    Bug Tracker
    Submit Patches
    Development Setup
    Wiki
    Follow Us
    Mailing Lists
    Reddit
    Twitter
    Mastodon
    Facebook
    YouTube

    Copyright © 2006-2025 Beanbag, Inc. All rights reserved.

    Terms of Service — Privacy Policy — AI Ethics Policy — Branding

    On this page

    • [Top]
    • TestCase
      • TestCase.local_site_name
      • TestCase.local_site_id
      • TestCase.maxDiff
      • TestCase.ws_re
      • TestCase.DEFAULT_FILEDIFF_DATA_DIFF
      • TestCase.DEFAULT_GIT_FILEDIFF_DATA_DIFF
      • TestCase.DEFAULT_GIT_README_DIFF
      • TestCase.DEFAULT_GIT_FILEMODE_DIFF
      • TestCase.DEFAULT_GIT_FILE_NOT_FOUND_DIFF
      • TestCase.DEFAULT_GIT_BINARY_IMAGE_DIFF
      • TestCase.setUpClass()
      • TestCase.tearDownClass()
      • TestCase.setUp()
      • TestCase.load_fixtures()
      • TestCase.shortDescription()
      • TestCase.get_local_site_or_none()
      • TestCase.get_local_site()
      • TestCase.create_local_site()
      • TestCase.create_http_request()
      • TestCase.create_user()
      • TestCase.create_webapi_token()
      • TestCase.assertQueries()
      • TestCase.assert_warns()
      • TestCase.create_diff_file_attachment()
      • TestCase.create_diffcommit()
      • TestCase.create_diffset()
      • TestCase.create_diff_comment()
      • TestCase.create_file_attachment()
      • TestCase.create_user_file_attachment()
      • TestCase.create_file_attachment_comment()
      • TestCase.create_file_attachment_history()
      • TestCase.create_filediff()
      • TestCase.create_repository()
      • TestCase.create_review_request()
      • TestCase.create_many_review_requests()
      • TestCase.create_review_request_draft()
      • TestCase.create_visit()
      • TestCase.create_review()
      • TestCase.create_review_group()
      • TestCase.create_reply()
      • TestCase.create_screenshot()
      • TestCase.create_screenshot_comment()
      • TestCase.create_file_attachment_base()
      • TestCase.create_general_comment()
      • TestCase.create_status_update()
      • TestCase.create_webhook()
      • TestCase.create_oauth_application()
      • TestCase.create_oauth_token()
      • TestCase.create_certificate()
      • TestCase.create_certificate_bundle()
      • TestCase.create_certificate_fingerprints()
      • TestCase.siteconfig_settings()
      • TestCase.__annotations__
    • BaseFileDiffAncestorTests
      • BaseFileDiffAncestorTests.fixtures
      • BaseFileDiffAncestorTests.set_up_filediffs()
      • BaseFileDiffAncestorTests.__annotations__
      • BaseFileDiffAncestorTests.get_filediffs_by_details()