reviewboard.webapi.tests.base¶
Base helpers for WebAPI unit tests.
- class BaseWebAPITestCase(methodName='runTest')[source]¶
Bases:
WebAPITestCaseMixin
,EmailTestHelper
,TestCase
Base class for WebAPI unit tests.
This manages initial setup and teardown for unit tests, and provides useful utility functions to aid in testing the API.
- error_mimetype = 'application/vnd.reviewboard.org.error+json'[source]¶
The default error mimetype.
- Type:
- siteconfig: SiteConfiguration¶
The site configuration used during the API test.
- user: Optional[User]¶
The currently logged-in user for the test.
This may be
None
.
- setUp() None [source]¶
Set up the unit test.
This will temporarily override site configuration settings to block all review e-mail code and disable site-wide login requirements. It will then set up a user for the test.
Settings will be restored once the test concludes.
- tearDown() None [source]¶
Tear down the unit test.
This will restore any previously-changed settings and clear out test state.
- get_sample_image_filename() str [source]¶
Return the path to a local image file that can be used for tests.
This must only be used for reading, and not for writing.
- Returns:
The absolute file path.
- Return type:
- __annotations__ = {'_saved_siteconfig_settings': 'JSONDict', 'siteconfig': 'SiteConfiguration', 'user': 'Optional[User]'}¶