diff --git a/bookwyrm/tests/activitypub/test_author.py b/bookwyrm/tests/activitypub/test_author.py index 7579909a8..7f21e570c 100644 --- a/bookwyrm/tests/activitypub/test_author.py +++ b/bookwyrm/tests/activitypub/test_author.py @@ -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", diff --git a/bookwyrm/tests/activitypub/test_quotation.py b/bookwyrm/tests/activitypub/test_quotation.py index 9a0867c52..50aeb5834 100644 --- a/bookwyrm/tests/activitypub/test_quotation.py +++ b/bookwyrm/tests/activitypub/test_quotation.py @@ -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", ) diff --git a/bookwyrm/tests/connectors/test_abstract_connector.py b/bookwyrm/tests/connectors/test_abstract_connector.py index b43966d6a..994286994 100644 --- a/bookwyrm/tests/connectors/test_abstract_connector.py +++ b/bookwyrm/tests/connectors/test_abstract_connector.py @@ -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", diff --git a/bookwyrm/tests/connectors/test_abstract_minimal_connector.py b/bookwyrm/tests/connectors/test_abstract_minimal_connector.py index 73399649e..cbbecf652 100644 --- a/bookwyrm/tests/connectors/test_abstract_minimal_connector.py +++ b/bookwyrm/tests/connectors/test_abstract_minimal_connector.py @@ -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", diff --git a/bookwyrm/tests/connectors/test_bookwyrm_connector.py b/bookwyrm/tests/connectors/test_bookwyrm_connector.py index 553901655..9a909aa8a 100644 --- a/bookwyrm/tests/connectors/test_bookwyrm_connector.py +++ b/bookwyrm/tests/connectors/test_bookwyrm_connector.py @@ -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", diff --git a/bookwyrm/tests/connectors/test_connector_manager.py b/bookwyrm/tests/connectors/test_connector_manager.py index cc01f1116..7c9512ced 100644 --- a/bookwyrm/tests/connectors/test_connector_manager.py +++ b/bookwyrm/tests/connectors/test_connector_manager.py @@ -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", diff --git a/bookwyrm/tests/connectors/test_openlibrary_connector.py b/bookwyrm/tests/connectors/test_openlibrary_connector.py index 487356400..72bac4244 100644 --- a/bookwyrm/tests/connectors/test_openlibrary_connector.py +++ b/bookwyrm/tests/connectors/test_openlibrary_connector.py @@ -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", diff --git a/bookwyrm/tests/models/test_book_model.py b/bookwyrm/tests/models/test_book_model.py index c6b854180..c40c94294 100644 --- a/bookwyrm/tests/models/test_book_model.py +++ b/bookwyrm/tests/models/test_book_model.py @@ -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): diff --git a/bookwyrm/tests/test_book_search.py b/bookwyrm/tests/test_book_search.py index d2056bfeb..4663d1cdc 100644 --- a/bookwyrm/tests/test_book_search.py +++ b/bookwyrm/tests/test_book_search.py @@ -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", ) diff --git a/bookwyrm/tests/views/test_setup.py b/bookwyrm/tests/views/test_setup.py index d2bdba340..7547b5646 100644 --- a/bookwyrm/tests/views/test_setup.py +++ b/bookwyrm/tests/views/test_setup.py @@ -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"""