|
@@ -454,9 +454,12 @@ class APITestCase(BaseTestCase, BaseAPITestCase):
|
|
|
must set the string `endpoint`.
|
|
|
"""
|
|
|
|
|
|
- endpoint = None
|
|
|
method = "get"
|
|
|
|
|
|
+ @property
|
|
|
+ def endpoint(self):
|
|
|
+ raise NotImplementedError(f"implement for {type(self).__module__}.{type(self).__name__}")
|
|
|
+
|
|
|
def get_response(self, *args, **params):
|
|
|
"""
|
|
|
Simulate an API call to the test case's URI and method.
|
|
@@ -471,9 +474,6 @@ class APITestCase(BaseTestCase, BaseAPITestCase):
|
|
|
* raw_data: (Optional) Sometimes we want to precompute the JSON body.
|
|
|
:returns Response object
|
|
|
"""
|
|
|
- if self.endpoint is None:
|
|
|
- raise Exception("Implement self.endpoint to use this method.")
|
|
|
-
|
|
|
url = reverse(self.endpoint, args=args)
|
|
|
# In some cases we want to pass querystring params to put/post, handle
|
|
|
# this here.
|
|
@@ -626,7 +626,9 @@ class AuthProviderTestCase(TestCase):
|
|
|
|
|
|
|
|
|
class RuleTestCase(TestCase):
|
|
|
- rule_cls = None
|
|
|
+ @property
|
|
|
+ def rule_cls(self):
|
|
|
+ raise NotImplementedError(f"implement for {type(self).__module__}.{type(self).__name__}")
|
|
|
|
|
|
def get_event(self):
|
|
|
return self.event
|
|
@@ -744,7 +746,9 @@ class PermissionTestCase(TestCase):
|
|
|
|
|
|
|
|
|
class PluginTestCase(TestCase):
|
|
|
- plugin = None
|
|
|
+ @property
|
|
|
+ def plugin(self):
|
|
|
+ raise NotImplementedError(f"implement for {type(self).__module__}.{type(self).__name__}")
|
|
|
|
|
|
def setUp(self):
|
|
|
super().setUp()
|
|
@@ -783,7 +787,10 @@ class PluginTestCase(TestCase):
|
|
|
|
|
|
class CliTestCase(TestCase):
|
|
|
runner = fixture(CliRunner)
|
|
|
- command = None
|
|
|
+
|
|
|
+ @property
|
|
|
+ def command(self):
|
|
|
+ raise NotImplementedError(f"implement for {type(self).__module__}.{type(self).__name__}")
|
|
|
|
|
|
default_args = []
|
|
|
|
|
@@ -830,7 +837,9 @@ class AcceptanceTestCase(TransactionTestCase):
|
|
|
|
|
|
|
|
|
class IntegrationTestCase(TestCase):
|
|
|
- provider = None
|
|
|
+ @property
|
|
|
+ def provider(self):
|
|
|
+ raise NotImplementedError(f"implement for {type(self).__module__}.{type(self).__name__}")
|
|
|
|
|
|
def setUp(self):
|
|
|
from sentry.integrations.pipeline import IntegrationPipeline
|
|
@@ -1318,7 +1327,7 @@ class IntegrationRepositoryTestCase(APITestCase):
|
|
|
self.login_as(self.user)
|
|
|
|
|
|
def add_create_repository_responses(self, repository_config):
|
|
|
- raise NotImplementedError
|
|
|
+ raise NotImplementedError(f"implement for {type(self).__module__}.{type(self).__name__}")
|
|
|
|
|
|
def create_repository(
|
|
|
self, repository_config, integration_id, organization_slug=None, add_responses=True
|
|
@@ -1362,7 +1371,7 @@ class ReleaseCommitPatchTest(APITestCase):
|
|
|
|
|
|
@fixture
|
|
|
def url(self):
|
|
|
- raise NotImplementedError
|
|
|
+ raise NotImplementedError(f"implement for {type(self).__module__}.{type(self).__name__}")
|
|
|
|
|
|
def assert_commit(self, commit, repo_id, key, author_id, message):
|
|
|
assert commit.organization_id == self.org.id
|
|
@@ -1535,16 +1544,16 @@ class TestMigrations(TransactionTestCase):
|
|
|
def app(self):
|
|
|
return "sentry"
|
|
|
|
|
|
- migrate_from = None
|
|
|
- migrate_to = None
|
|
|
+ @property
|
|
|
+ def migrate_from(self):
|
|
|
+ raise NotImplementedError(f"implement for {type(self).__module__}.{type(self).__name__}")
|
|
|
+
|
|
|
+ @property
|
|
|
+ def migrate_to(self):
|
|
|
+ raise NotImplementedError(f"implement for {type(self).__module__}.{type(self).__name__}")
|
|
|
|
|
|
def setUp(self):
|
|
|
super().setUp()
|
|
|
- assert (
|
|
|
- self.migrate_from and self.migrate_to
|
|
|
- ), "TestCase '{}' must define migrate_from and migrate_to properties".format(
|
|
|
- type(self).__name__
|
|
|
- )
|
|
|
self.migrate_from = [(self.app, self.migrate_from)]
|
|
|
self.migrate_to = [(self.app, self.migrate_to)]
|
|
|
|