Use setUpTestData() to speed up tests
Pylint's `bad-classmethod-argument` is disabled for each definition to avoid rewriting the method bodies just to rename `self` → `cls`. This can be done gradually, as the setUpTestData methods are modified along the way.
This commit is contained in:
parent
cf1afefc84
commit
9d502f5ee2
129 changed files with 644 additions and 327 deletions
|
@ -11,9 +11,9 @@ from bookwyrm.context_processors import site_settings
|
|||
class ContextProcessor(TestCase):
|
||||
"""pages you land on without really trying"""
|
||||
|
||||
def setUp(self):
|
||||
@classmethod
|
||||
def setUpTestData(self): # pylint: disable=bad-classmethod-argument
|
||||
"""we need basic test data and mocks"""
|
||||
self.factory = RequestFactory()
|
||||
with patch("bookwyrm.suggested_users.rerank_suggestions_task.delay"), patch(
|
||||
"bookwyrm.activitystreams.populate_stream_task.delay"
|
||||
), patch("bookwyrm.lists_stream.populate_lists_task.delay"):
|
||||
|
@ -28,6 +28,10 @@ class ContextProcessor(TestCase):
|
|||
self.anonymous_user.is_authenticated = False
|
||||
self.site = models.SiteSettings.objects.create()
|
||||
|
||||
def setUp(self):
|
||||
"""other test data"""
|
||||
self.factory = RequestFactory()
|
||||
|
||||
def test_theme_unset(self):
|
||||
"""logged in user, no selected theme"""
|
||||
request = self.factory.get("")
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue