mirror of
https://github.com/bookwyrm-social/bookwyrm.git
synced 2024-11-25 19:11:09 +00:00
Fix remaining instances of bad-classmethod-argument
This commit is contained in:
parent
e2c9ea3cd2
commit
90bd893568
10 changed files with 34 additions and 34 deletions
|
@ -7,13 +7,13 @@ class Author(TestCase):
|
|||
"""serialize author tests"""
|
||||
|
||||
@classmethod
|
||||
def setUpTestData(self): # pylint: disable=bad-classmethod-argument
|
||||
def setUpTestData(cls):
|
||||
"""initial data"""
|
||||
self.book = models.Edition.objects.create(
|
||||
cls.book = models.Edition.objects.create(
|
||||
title="Example Edition",
|
||||
remote_id="https://example.com/book/1",
|
||||
)
|
||||
self.author = models.Author.objects.create(
|
||||
cls.author = models.Author.objects.create(
|
||||
name="Author fullname",
|
||||
aliases=["One", "Two"],
|
||||
bio="bio bio bio",
|
||||
|
|
|
@ -11,10 +11,10 @@ class Quotation(TestCase):
|
|||
"""we have hecka ways to create statuses"""
|
||||
|
||||
@classmethod
|
||||
def setUpTestData(self): # pylint: disable=bad-classmethod-argument
|
||||
def setUpTestData(cls):
|
||||
"""model objects we'll need"""
|
||||
with patch("bookwyrm.models.user.set_remote_server.delay"):
|
||||
self.user = models.User.objects.create_user(
|
||||
cls.user = models.User.objects.create_user(
|
||||
"mouse",
|
||||
"mouse@mouse.mouse",
|
||||
"mouseword",
|
||||
|
@ -23,7 +23,7 @@ class Quotation(TestCase):
|
|||
outbox="https://example.com/user/mouse/outbox",
|
||||
remote_id="https://example.com/user/mouse",
|
||||
)
|
||||
self.book = models.Edition.objects.create(
|
||||
cls.book = models.Edition.objects.create(
|
||||
title="Example Edition",
|
||||
remote_id="https://example.com/book/1",
|
||||
)
|
||||
|
|
|
@ -13,7 +13,7 @@ class AbstractConnector(TestCase):
|
|||
"""generic code for connecting to outside data sources"""
|
||||
|
||||
@classmethod
|
||||
def setUpTestData(self): # pylint: disable=bad-classmethod-argument
|
||||
def setUpTestData(cls):
|
||||
"""we need an example connector in the database"""
|
||||
models.Connector.objects.create(
|
||||
identifier="example.com",
|
||||
|
@ -23,7 +23,7 @@ class AbstractConnector(TestCase):
|
|||
covers_url="https://example.com/covers",
|
||||
search_url="https://example.com/search?q=",
|
||||
)
|
||||
self.book = models.Edition.objects.create(
|
||||
cls.book = models.Edition.objects.create(
|
||||
title="Test Book",
|
||||
remote_id="https://example.com/book/1234",
|
||||
openlibrary_key="OL1234M",
|
||||
|
|
|
@ -10,9 +10,9 @@ class AbstractConnector(TestCase):
|
|||
"""generic code for connecting to outside data sources"""
|
||||
|
||||
@classmethod
|
||||
def setUpTestData(self): # pylint: disable=bad-classmethod-argument
|
||||
def setUpTestData(cls):
|
||||
"""we need an example connector in the database"""
|
||||
self.connector_info = models.Connector.objects.create(
|
||||
cls.connector_info = models.Connector.objects.create(
|
||||
identifier="example.com",
|
||||
connector_file="openlibrary",
|
||||
base_url="https://example.com",
|
||||
|
|
|
@ -12,7 +12,7 @@ class BookWyrmConnector(TestCase):
|
|||
"""this connector doesn't do much, just search"""
|
||||
|
||||
@classmethod
|
||||
def setUpTestData(self): # pylint: disable=bad-classmethod-argument
|
||||
def setUpTestData(cls):
|
||||
"""create bookwrym_connector in the database"""
|
||||
models.Connector.objects.create(
|
||||
identifier="example.com",
|
||||
|
|
|
@ -11,18 +11,18 @@ class ConnectorManager(TestCase):
|
|||
"""interface between the app and various connectors"""
|
||||
|
||||
@classmethod
|
||||
def setUpTestData(self): # pylint: disable=bad-classmethod-argument
|
||||
def setUpTestData(cls):
|
||||
"""we'll need some books and a connector info entry"""
|
||||
self.work = models.Work.objects.create(title="Example Work")
|
||||
cls.work = models.Work.objects.create(title="Example Work")
|
||||
|
||||
models.Edition.objects.create(
|
||||
title="Example Edition", parent_work=self.work, isbn_10="0000000000"
|
||||
title="Example Edition", parent_work=cls.work, isbn_10="0000000000"
|
||||
)
|
||||
self.edition = models.Edition.objects.create(
|
||||
title="Another Edition", parent_work=self.work, isbn_10="1111111111"
|
||||
cls.edition = models.Edition.objects.create(
|
||||
title="Another Edition", parent_work=cls.work, isbn_10="1111111111"
|
||||
)
|
||||
|
||||
self.remote_connector = models.Connector.objects.create(
|
||||
cls.remote_connector = models.Connector.objects.create(
|
||||
identifier="test_connector_remote",
|
||||
priority=1,
|
||||
connector_file="bookwyrm_connector",
|
||||
|
|
|
@ -19,7 +19,7 @@ class Openlibrary(TestCase):
|
|||
"""test loading data from openlibrary.org"""
|
||||
|
||||
@classmethod
|
||||
def setUpTestData(self): # pylint: disable=bad-classmethod-argument
|
||||
def setUpTestData(cls):
|
||||
"""creates the connector in the database"""
|
||||
models.Connector.objects.create(
|
||||
identifier="openlibrary.org",
|
||||
|
|
|
@ -19,17 +19,17 @@ class Book(TestCase):
|
|||
"""not too much going on in the books model but here we are"""
|
||||
|
||||
@classmethod
|
||||
def setUpTestData(self): # pylint: disable=bad-classmethod-argument
|
||||
def setUpTestData(cls):
|
||||
"""we'll need some books"""
|
||||
self.work = models.Work.objects.create(
|
||||
cls.work = models.Work.objects.create(
|
||||
title="Example Work", remote_id="https://example.com/book/1"
|
||||
)
|
||||
self.first_edition = models.Edition.objects.create(
|
||||
title="Example Edition", parent_work=self.work
|
||||
cls.first_edition = models.Edition.objects.create(
|
||||
title="Example Edition", parent_work=cls.work
|
||||
)
|
||||
self.second_edition = models.Edition.objects.create(
|
||||
cls.second_edition = models.Edition.objects.create(
|
||||
title="Another Example Edition",
|
||||
parent_work=self.work,
|
||||
parent_work=cls.work,
|
||||
)
|
||||
|
||||
def test_remote_id(self):
|
||||
|
|
|
@ -11,27 +11,27 @@ class BookSearch(TestCase):
|
|||
"""look for some books"""
|
||||
|
||||
@classmethod
|
||||
def setUpTestData(self): # pylint: disable=bad-classmethod-argument
|
||||
def setUpTestData(cls):
|
||||
"""we need basic test data and mocks"""
|
||||
self.work = models.Work.objects.create(title="Example Work")
|
||||
cls.work = models.Work.objects.create(title="Example Work")
|
||||
|
||||
self.first_edition = models.Edition.objects.create(
|
||||
cls.first_edition = models.Edition.objects.create(
|
||||
title="Example Edition",
|
||||
parent_work=self.work,
|
||||
parent_work=cls.work,
|
||||
isbn_10="0000000000",
|
||||
physical_format="Paperback",
|
||||
published_date=datetime.datetime(2019, 4, 9, 0, 0, tzinfo=timezone.utc),
|
||||
)
|
||||
self.second_edition = models.Edition.objects.create(
|
||||
cls.second_edition = models.Edition.objects.create(
|
||||
title="Another Edition",
|
||||
parent_work=self.work,
|
||||
parent_work=cls.work,
|
||||
isbn_10="1111111111",
|
||||
openlibrary_key="hello",
|
||||
pages=150,
|
||||
)
|
||||
self.third_edition = models.Edition.objects.create(
|
||||
cls.third_edition = models.Edition.objects.create(
|
||||
title="Another Edition with annoying ISBN",
|
||||
parent_work=self.work,
|
||||
parent_work=cls.work,
|
||||
isbn_10="022222222X",
|
||||
)
|
||||
|
||||
|
|
|
@ -14,9 +14,9 @@ class SetupViews(TestCase):
|
|||
"""activity feed, statuses, dms"""
|
||||
|
||||
@classmethod
|
||||
def setUpTestData(self): # pylint: disable=bad-classmethod-argument
|
||||
def setUpTestData(cls):
|
||||
"""we need basic test data and mocks"""
|
||||
self.site = models.SiteSettings.objects.create(install_mode=True)
|
||||
cls.site = models.SiteSettings.objects.create(install_mode=True)
|
||||
|
||||
def setUp(self):
|
||||
"""individual test setup"""
|
||||
|
|
Loading…
Reference in a new issue