forked from mirrors/bookwyrm
Fixes mocks syntax
This commit is contained in:
parent
72d5238590
commit
227b72eaf9
8 changed files with 58 additions and 59 deletions
|
@ -56,7 +56,7 @@ class GoodreadsImport(TestCase):
|
|||
parent_work=work,
|
||||
)
|
||||
|
||||
def test_create_job(self, _):
|
||||
def test_create_job(self, *_):
|
||||
"""creates the import job entry and checks csv"""
|
||||
import_job = self.importer.create_job(self.user, self.csv, False, "public")
|
||||
self.assertEqual(import_job.user, self.user)
|
||||
|
@ -72,7 +72,7 @@ class GoodreadsImport(TestCase):
|
|||
self.assertEqual(import_items[2].index, 2)
|
||||
self.assertEqual(import_items[2].data["Book Id"], "28694510")
|
||||
|
||||
def test_create_retry_job(self, _):
|
||||
def test_create_retry_job(self, *_):
|
||||
"""trying again with items that didn't import"""
|
||||
import_job = self.importer.create_job(self.user, self.csv, False, "unlisted")
|
||||
import_items = models.ImportItem.objects.filter(job=import_job).all()[:2]
|
||||
|
@ -90,7 +90,7 @@ class GoodreadsImport(TestCase):
|
|||
self.assertEqual(retry_items[1].index, 1)
|
||||
self.assertEqual(retry_items[1].data["Book Id"], "52691223")
|
||||
|
||||
def test_start_import(self, _):
|
||||
def test_start_import(self, *_):
|
||||
"""begin loading books"""
|
||||
import_job = self.importer.create_job(self.user, self.csv, False, "unlisted")
|
||||
MockTask = namedtuple("Task", ("id"))
|
||||
|
@ -102,7 +102,7 @@ class GoodreadsImport(TestCase):
|
|||
self.assertEqual(import_job.task_id, "7")
|
||||
|
||||
@responses.activate
|
||||
def test_import_data(self, _):
|
||||
def test_import_data(self, *_):
|
||||
"""resolve entry"""
|
||||
import_job = self.importer.create_job(self.user, self.csv, False, "unlisted")
|
||||
book = models.Edition.objects.create(title="Test Book")
|
||||
|
@ -117,7 +117,7 @@ class GoodreadsImport(TestCase):
|
|||
import_item = models.ImportItem.objects.get(job=import_job, index=0)
|
||||
self.assertEqual(import_item.book.id, book.id)
|
||||
|
||||
def test_handle_imported_book(self, _):
|
||||
def test_handle_imported_book(self, *_):
|
||||
"""goodreads import added a book, this adds related connections"""
|
||||
shelf = self.user.shelf_set.filter(identifier="read").first()
|
||||
self.assertIsNone(shelf.books.first())
|
||||
|
@ -148,7 +148,7 @@ class GoodreadsImport(TestCase):
|
|||
self.assertEqual(readthrough.start_date, make_date(2020, 10, 21))
|
||||
self.assertEqual(readthrough.finish_date, make_date(2020, 10, 25))
|
||||
|
||||
def test_handle_imported_book_already_shelved(self, _):
|
||||
def test_handle_imported_book_already_shelved(self, *_):
|
||||
"""goodreads import added a book, this adds related connections"""
|
||||
with patch("bookwyrm.models.activitypub_mixin.broadcast_task.delay"):
|
||||
shelf = self.user.shelf_set.filter(identifier="to-read").first()
|
||||
|
@ -186,7 +186,7 @@ class GoodreadsImport(TestCase):
|
|||
self.assertEqual(readthrough.start_date, make_date(2020, 10, 21))
|
||||
self.assertEqual(readthrough.finish_date, make_date(2020, 10, 25))
|
||||
|
||||
def test_handle_import_twice(self, _):
|
||||
def test_handle_import_twice(self, *_):
|
||||
"""re-importing books"""
|
||||
shelf = self.user.shelf_set.filter(identifier="read").first()
|
||||
import_job = models.ImportJob.objects.create(user=self.user)
|
||||
|
@ -264,7 +264,7 @@ class GoodreadsImport(TestCase):
|
|||
self.assertEqual(review.published_date, make_date(2019, 7, 8))
|
||||
self.assertEqual(review.privacy, "unlisted")
|
||||
|
||||
def test_handle_imported_book_reviews_disabled(self, _):
|
||||
def test_handle_imported_book_reviews_disabled(self, *_):
|
||||
"""goodreads review import"""
|
||||
import_job = models.ImportJob.objects.create(user=self.user)
|
||||
datafile = pathlib.Path(__file__).parent.joinpath("../data/goodreads.csv")
|
||||
|
|
|
@ -57,7 +57,7 @@ class LibrarythingImport(TestCase):
|
|||
parent_work=work,
|
||||
)
|
||||
|
||||
def test_create_job(self, _):
|
||||
def test_create_job(self, *_):
|
||||
"""creates the import job entry and checks csv"""
|
||||
import_job = self.importer.create_job(self.user, self.csv, False, "public")
|
||||
self.assertEqual(import_job.user, self.user)
|
||||
|
@ -73,7 +73,7 @@ class LibrarythingImport(TestCase):
|
|||
self.assertEqual(import_items[2].index, 2)
|
||||
self.assertEqual(import_items[2].data["Book Id"], "5015399")
|
||||
|
||||
def test_create_retry_job(self, _):
|
||||
def test_create_retry_job(self, *_):
|
||||
"""trying again with items that didn't import"""
|
||||
import_job = self.importer.create_job(self.user, self.csv, False, "unlisted")
|
||||
import_items = models.ImportItem.objects.filter(job=import_job).all()[:2]
|
||||
|
@ -92,7 +92,7 @@ class LibrarythingImport(TestCase):
|
|||
self.assertEqual(retry_items[1].data["Book Id"], "5015319")
|
||||
|
||||
@responses.activate
|
||||
def test_import_data(self, _):
|
||||
def test_import_data(self, *_):
|
||||
"""resolve entry"""
|
||||
import_job = self.importer.create_job(self.user, self.csv, False, "unlisted")
|
||||
book = models.Edition.objects.create(title="Test Book")
|
||||
|
@ -107,7 +107,7 @@ class LibrarythingImport(TestCase):
|
|||
import_item = models.ImportItem.objects.get(job=import_job, index=0)
|
||||
self.assertEqual(import_item.book.id, book.id)
|
||||
|
||||
def test_handle_imported_book(self, _):
|
||||
def test_handle_imported_book(self, *_):
|
||||
"""librarything import added a book, this adds related connections"""
|
||||
shelf = self.user.shelf_set.filter(identifier="read").first()
|
||||
self.assertIsNone(shelf.books.first())
|
||||
|
@ -137,7 +137,7 @@ class LibrarythingImport(TestCase):
|
|||
self.assertEqual(readthrough.start_date, make_date(2007, 4, 16))
|
||||
self.assertEqual(readthrough.finish_date, make_date(2007, 5, 8))
|
||||
|
||||
def test_handle_imported_book_already_shelved(self, _):
|
||||
def test_handle_imported_book_already_shelved(self, *_):
|
||||
"""librarything import added a book, this adds related connections"""
|
||||
with patch("bookwyrm.models.activitypub_mixin.broadcast_task.delay"):
|
||||
shelf = self.user.shelf_set.filter(identifier="to-read").first()
|
||||
|
@ -169,7 +169,7 @@ class LibrarythingImport(TestCase):
|
|||
self.assertEqual(readthrough.start_date, make_date(2007, 4, 16))
|
||||
self.assertEqual(readthrough.finish_date, make_date(2007, 5, 8))
|
||||
|
||||
def test_handle_import_twice(self, _):
|
||||
def test_handle_import_twice(self, *_):
|
||||
"""re-importing books"""
|
||||
shelf = self.user.shelf_set.filter(identifier="read").first()
|
||||
import_job = models.ImportJob.objects.create(user=self.user)
|
||||
|
@ -222,7 +222,7 @@ class LibrarythingImport(TestCase):
|
|||
self.assertEqual(review.published_date, make_date(2007, 5, 8))
|
||||
self.assertEqual(review.privacy, "unlisted")
|
||||
|
||||
def test_handle_imported_book_reviews_disabled(self, _):
|
||||
def test_handle_imported_book_reviews_disabled(self, *_):
|
||||
"""librarything review import"""
|
||||
import_job = models.ImportJob.objects.create(user=self.user)
|
||||
datafile = pathlib.Path(__file__).parent.joinpath("../data/librarything.tsv")
|
||||
|
|
|
@ -29,7 +29,7 @@ from bookwyrm.models.activitypub_mixin import ActivitypubMixin
|
|||
class ModelFields(TestCase):
|
||||
"""overwrites standard model feilds to work with activitypub"""
|
||||
|
||||
def test_validate_remote_id(self, _):
|
||||
def test_validate_remote_id(self, *_):
|
||||
"""should look like a url"""
|
||||
self.assertIsNone(fields.validate_remote_id("http://www.example.com"))
|
||||
self.assertIsNone(fields.validate_remote_id("https://www.example.com"))
|
||||
|
@ -46,7 +46,7 @@ class ModelFields(TestCase):
|
|||
"http://www.example.com/dlfjg 23/x",
|
||||
)
|
||||
|
||||
def test_activitypub_field_mixin(self, _):
|
||||
def test_activitypub_field_mixin(self, *_):
|
||||
"""generic mixin with super basic to and from functionality"""
|
||||
instance = fields.ActivitypubFieldMixin()
|
||||
self.assertEqual(instance.field_to_activity("fish"), "fish")
|
||||
|
@ -64,7 +64,7 @@ class ModelFields(TestCase):
|
|||
instance.name = "snake_case_name"
|
||||
self.assertEqual(instance.get_activitypub_field(), "snakeCaseName")
|
||||
|
||||
def test_set_field_from_activity(self, _):
|
||||
def test_set_field_from_activity(self, *_):
|
||||
"""setter from entire json blob"""
|
||||
|
||||
@dataclass
|
||||
|
@ -83,7 +83,7 @@ class ModelFields(TestCase):
|
|||
instance.set_field_from_activity(mock_model, data)
|
||||
self.assertEqual(mock_model.field_name, "hi")
|
||||
|
||||
def test_set_activity_from_field(self, _):
|
||||
def test_set_activity_from_field(self, *_):
|
||||
"""set json field given entire model"""
|
||||
|
||||
@dataclass
|
||||
|
@ -101,7 +101,7 @@ class ModelFields(TestCase):
|
|||
instance.set_activity_from_field(data, mock_model)
|
||||
self.assertEqual(data["fieldName"], "bip")
|
||||
|
||||
def test_remote_id_field(self, _):
|
||||
def test_remote_id_field(self, *_):
|
||||
"""just sets some defaults on charfield"""
|
||||
instance = fields.RemoteIdField()
|
||||
self.assertEqual(instance.max_length, 255)
|
||||
|
@ -110,7 +110,7 @@ class ModelFields(TestCase):
|
|||
with self.assertRaises(ValidationError):
|
||||
instance.run_validators("http://www.example.com/dlfjg 23/x")
|
||||
|
||||
def test_username_field(self, _):
|
||||
def test_username_field(self, *_):
|
||||
"""again, just setting defaults on username field"""
|
||||
instance = fields.UsernameField()
|
||||
self.assertEqual(instance.activitypub_field, "preferredUsername")
|
||||
|
@ -131,7 +131,7 @@ class ModelFields(TestCase):
|
|||
|
||||
self.assertEqual(instance.field_to_activity("test@example.com"), "test")
|
||||
|
||||
def test_privacy_field_defaults(self, _):
|
||||
def test_privacy_field_defaults(self, *_):
|
||||
"""post privacy field's many default values"""
|
||||
instance = fields.PrivacyField()
|
||||
self.assertEqual(instance.max_length, 255)
|
||||
|
@ -144,7 +144,7 @@ class ModelFields(TestCase):
|
|||
instance.public, "https://www.w3.org/ns/activitystreams#Public"
|
||||
)
|
||||
|
||||
def test_privacy_field_set_field_from_activity(self, _):
|
||||
def test_privacy_field_set_field_from_activity(self, *_):
|
||||
"""translate between to/cc fields and privacy"""
|
||||
|
||||
with patch("bookwyrm.models.user.set_remote_server.delay"):
|
||||
|
@ -252,7 +252,7 @@ class ModelFields(TestCase):
|
|||
self.assertEqual(activity["to"], [user.remote_id])
|
||||
self.assertEqual(activity["cc"], [])
|
||||
|
||||
def test_foreign_key(self, _):
|
||||
def test_foreign_key(self, *_):
|
||||
"""should be able to format a related model"""
|
||||
instance = fields.ForeignKey("User", on_delete=models.CASCADE)
|
||||
Serializable = namedtuple("Serializable", ("to_activity", "remote_id"))
|
||||
|
@ -261,7 +261,7 @@ class ModelFields(TestCase):
|
|||
self.assertEqual(instance.field_to_activity(item), "https://e.b/c")
|
||||
|
||||
@responses.activate
|
||||
def test_foreign_key_from_activity_str(self, _):
|
||||
def test_foreign_key_from_activity_str(self, *_):
|
||||
"""create a new object from a foreign key"""
|
||||
instance = fields.ForeignKey(User, on_delete=models.CASCADE)
|
||||
datafile = pathlib.Path(__file__).parent.joinpath("../data/ap_user.json")
|
||||
|
@ -308,7 +308,7 @@ class ModelFields(TestCase):
|
|||
self.assertEqual(value.name, "MOUSE?? MOUSE!!")
|
||||
# et cetera but we're not testing serializing user json
|
||||
|
||||
def test_foreign_key_from_activity_dict_existing(self, _):
|
||||
def test_foreign_key_from_activity_dict_existing(self, *_):
|
||||
"""test receiving a dict of an existing object in the db"""
|
||||
instance = fields.ForeignKey(User, on_delete=models.CASCADE)
|
||||
datafile = pathlib.Path(__file__).parent.joinpath("../data/ap_user.json")
|
||||
|
@ -327,7 +327,7 @@ class ModelFields(TestCase):
|
|||
value = instance.field_from_activity(activitypub.Person(**userdata))
|
||||
self.assertEqual(value, user)
|
||||
|
||||
def test_foreign_key_from_activity_str_existing(self, _):
|
||||
def test_foreign_key_from_activity_str_existing(self, *_):
|
||||
"""test receiving a remote id of an existing object in the db"""
|
||||
instance = fields.ForeignKey(User, on_delete=models.CASCADE)
|
||||
user = User.objects.create_user(
|
||||
|
@ -340,14 +340,14 @@ class ModelFields(TestCase):
|
|||
value = instance.field_from_activity(user.remote_id)
|
||||
self.assertEqual(value, user)
|
||||
|
||||
def test_one_to_one_field(self, _):
|
||||
def test_one_to_one_field(self, *_):
|
||||
"""a gussied up foreign key"""
|
||||
instance = fields.OneToOneField("User", on_delete=models.CASCADE)
|
||||
Serializable = namedtuple("Serializable", ("to_activity", "remote_id"))
|
||||
item = Serializable(lambda: {"a": "b"}, "https://e.b/c")
|
||||
self.assertEqual(instance.field_to_activity(item), {"a": "b"})
|
||||
|
||||
def test_many_to_many_field(self, _):
|
||||
def test_many_to_many_field(self, *_):
|
||||
"""lists!"""
|
||||
instance = fields.ManyToManyField("User")
|
||||
|
||||
|
@ -365,7 +365,7 @@ class ModelFields(TestCase):
|
|||
self.assertEqual(instance.field_to_activity(items), "example.com/snake_case")
|
||||
|
||||
@responses.activate
|
||||
def test_many_to_many_field_from_activity(self, _):
|
||||
def test_many_to_many_field_from_activity(self, *_):
|
||||
"""resolve related fields for a list, takes a list of remote ids"""
|
||||
instance = fields.ManyToManyField(User)
|
||||
datafile = pathlib.Path(__file__).parent.joinpath("../data/ap_user.json")
|
||||
|
@ -385,7 +385,7 @@ class ModelFields(TestCase):
|
|||
self.assertEqual(len(value), 1)
|
||||
self.assertIsInstance(value[0], User)
|
||||
|
||||
def test_tag_field(self, _):
|
||||
def test_tag_field(self, *_):
|
||||
"""a special type of many to many field"""
|
||||
instance = fields.TagField("User")
|
||||
|
||||
|
@ -404,7 +404,7 @@ class ModelFields(TestCase):
|
|||
self.assertEqual(result[0].name, "Name")
|
||||
self.assertEqual(result[0].type, "Serializable")
|
||||
|
||||
def test_tag_field_from_activity(self, _):
|
||||
def test_tag_field_from_activity(self, *_):
|
||||
"""loadin' a list of items from Links"""
|
||||
# TODO
|
||||
|
||||
|
@ -449,7 +449,7 @@ class ModelFields(TestCase):
|
|||
self.assertIsInstance(loaded_image, list)
|
||||
self.assertIsInstance(loaded_image[1], ContentFile)
|
||||
|
||||
def test_image_serialize(self, _):
|
||||
def test_image_serialize(self, *_):
|
||||
"""make sure we're creating sensible image paths"""
|
||||
ValueMock = namedtuple("ValueMock", ("url"))
|
||||
value_mock = ValueMock("/images/fish.jpg")
|
||||
|
@ -458,7 +458,7 @@ class ModelFields(TestCase):
|
|||
self.assertEqual(result.url, "https://your.domain.here/images/fish.jpg")
|
||||
self.assertEqual(result.name, "hello")
|
||||
|
||||
def test_datetime_field(self, _):
|
||||
def test_datetime_field(self, *_):
|
||||
"""this one is pretty simple, it just has to use isoformat"""
|
||||
instance = fields.DateTimeField()
|
||||
now = timezone.now()
|
||||
|
@ -466,12 +466,12 @@ class ModelFields(TestCase):
|
|||
self.assertEqual(instance.field_from_activity(now.isoformat()), now)
|
||||
self.assertEqual(instance.field_from_activity("bip"), None)
|
||||
|
||||
def test_array_field(self, _):
|
||||
def test_array_field(self, *_):
|
||||
"""idk why it makes them strings but probably for a good reason"""
|
||||
instance = fields.ArrayField(fields.IntegerField)
|
||||
self.assertEqual(instance.field_to_activity([0, 1]), ["0", "1"])
|
||||
|
||||
def test_html_field(self, _):
|
||||
def test_html_field(self, *_):
|
||||
"""sanitizes html, the sanitizer has its own tests"""
|
||||
instance = fields.HtmlField()
|
||||
self.assertEqual(
|
||||
|
|
|
@ -23,7 +23,7 @@ class Shelf(TestCase):
|
|||
work = models.Work.objects.create(title="Test Work")
|
||||
self.book = models.Edition.objects.create(title="test book", parent_work=work)
|
||||
|
||||
def test_remote_id(self, _):
|
||||
def test_remote_id(self, *_):
|
||||
"""shelves use custom remote ids"""
|
||||
with patch("bookwyrm.models.activitypub_mixin.broadcast_task.delay"):
|
||||
shelf = models.Shelf.objects.create(
|
||||
|
@ -32,7 +32,7 @@ class Shelf(TestCase):
|
|||
expected_id = "https://%s/user/mouse/books/test-shelf" % settings.DOMAIN
|
||||
self.assertEqual(shelf.get_remote_id(), expected_id)
|
||||
|
||||
def test_to_activity(self, _):
|
||||
def test_to_activity(self, *_):
|
||||
"""jsonify it"""
|
||||
with patch("bookwyrm.models.activitypub_mixin.broadcast_task.delay"):
|
||||
shelf = models.Shelf.objects.create(
|
||||
|
@ -46,7 +46,7 @@ class Shelf(TestCase):
|
|||
self.assertEqual(activity_json["name"], "Test Shelf")
|
||||
self.assertEqual(activity_json["owner"], self.local_user.remote_id)
|
||||
|
||||
def test_create_update_shelf(self, _):
|
||||
def test_create_update_shelf(self, *_):
|
||||
"""create and broadcast shelf creation"""
|
||||
|
||||
with patch("bookwyrm.models.activitypub_mixin.broadcast_task.delay") as mock:
|
||||
|
@ -67,7 +67,7 @@ class Shelf(TestCase):
|
|||
self.assertEqual(activity["object"]["name"], "arthur russel")
|
||||
self.assertEqual(shelf.name, "arthur russel")
|
||||
|
||||
def test_shelve(self, _):
|
||||
def test_shelve(self, *_):
|
||||
"""create and broadcast shelf creation"""
|
||||
with patch("bookwyrm.models.activitypub_mixin.broadcast_task.delay"):
|
||||
shelf = models.Shelf.objects.create(
|
||||
|
|
|
@ -38,7 +38,7 @@ class AuthenticationViews(TestCase):
|
|||
id=1, require_confirm_email=False
|
||||
)
|
||||
|
||||
def test_login_get(self, _):
|
||||
def test_login_get(self, *_):
|
||||
"""there are so many views, this just makes sure it LOADS"""
|
||||
login = views.Login.as_view()
|
||||
request = self.factory.get("")
|
||||
|
@ -54,7 +54,7 @@ class AuthenticationViews(TestCase):
|
|||
self.assertEqual(result.url, "/")
|
||||
self.assertEqual(result.status_code, 302)
|
||||
|
||||
def test_login_post_localname(self, _):
|
||||
def test_login_post_localname(self, *_):
|
||||
"""there are so many views, this just makes sure it LOADS"""
|
||||
view = views.Login.as_view()
|
||||
form = forms.LoginForm()
|
||||
|
@ -68,7 +68,7 @@ class AuthenticationViews(TestCase):
|
|||
self.assertEqual(result.url, "/")
|
||||
self.assertEqual(result.status_code, 302)
|
||||
|
||||
def test_login_post_username(self, _):
|
||||
def test_login_post_username(self, *_):
|
||||
"""there are so many views, this just makes sure it LOADS"""
|
||||
view = views.Login.as_view()
|
||||
form = forms.LoginForm()
|
||||
|
@ -82,7 +82,7 @@ class AuthenticationViews(TestCase):
|
|||
self.assertEqual(result.url, "/")
|
||||
self.assertEqual(result.status_code, 302)
|
||||
|
||||
def test_login_post_email(self, _):
|
||||
def test_login_post_email(self, *_):
|
||||
"""there are so many views, this just makes sure it LOADS"""
|
||||
view = views.Login.as_view()
|
||||
form = forms.LoginForm()
|
||||
|
@ -96,7 +96,7 @@ class AuthenticationViews(TestCase):
|
|||
self.assertEqual(result.url, "/")
|
||||
self.assertEqual(result.status_code, 302)
|
||||
|
||||
def test_login_post_invalid_credentials(self, _):
|
||||
def test_login_post_invalid_credentials(self, *_):
|
||||
"""there are so many views, this just makes sure it LOADS"""
|
||||
view = views.Login.as_view()
|
||||
form = forms.LoginForm()
|
||||
|
@ -114,7 +114,7 @@ class AuthenticationViews(TestCase):
|
|||
"Username or password are incorrect",
|
||||
)
|
||||
|
||||
def test_register(self, _):
|
||||
def test_register(self, *_):
|
||||
"""create a user"""
|
||||
view = views.Register.as_view()
|
||||
self.assertEqual(models.User.objects.count(), 1)
|
||||
|
@ -162,7 +162,7 @@ class AuthenticationViews(TestCase):
|
|||
self.assertEqual(nutria.deactivation_reason, "pending")
|
||||
self.assertIsNotNone(nutria.confirmation_code)
|
||||
|
||||
def test_register_trailing_space(self, _):
|
||||
def test_register_trailing_space(self, *_):
|
||||
"""django handles this so weirdly"""
|
||||
view = views.Register.as_view()
|
||||
request = self.factory.post(
|
||||
|
@ -178,7 +178,7 @@ class AuthenticationViews(TestCase):
|
|||
self.assertEqual(nutria.localname, "nutria")
|
||||
self.assertEqual(nutria.local, True)
|
||||
|
||||
def test_register_invalid_email(self, _):
|
||||
def test_register_invalid_email(self, *_):
|
||||
"""gotta have an email"""
|
||||
view = views.Register.as_view()
|
||||
self.assertEqual(models.User.objects.count(), 1)
|
||||
|
@ -189,7 +189,7 @@ class AuthenticationViews(TestCase):
|
|||
self.assertEqual(models.User.objects.count(), 1)
|
||||
response.render()
|
||||
|
||||
def test_register_invalid_username(self, _):
|
||||
def test_register_invalid_username(self, *_):
|
||||
"""gotta have an email"""
|
||||
view = views.Register.as_view()
|
||||
self.assertEqual(models.User.objects.count(), 1)
|
||||
|
@ -217,7 +217,7 @@ class AuthenticationViews(TestCase):
|
|||
self.assertEqual(models.User.objects.count(), 1)
|
||||
response.render()
|
||||
|
||||
def test_register_closed_instance(self, _):
|
||||
def test_register_closed_instance(self, *_):
|
||||
"""you can't just register"""
|
||||
view = views.Register.as_view()
|
||||
self.settings.allow_registration = False
|
||||
|
@ -229,7 +229,7 @@ class AuthenticationViews(TestCase):
|
|||
with self.assertRaises(PermissionDenied):
|
||||
view(request)
|
||||
|
||||
def test_register_invite(self, _):
|
||||
def test_register_invite(self, *_):
|
||||
"""you can't just register"""
|
||||
view = views.Register.as_view()
|
||||
self.settings.allow_registration = False
|
||||
|
@ -282,7 +282,7 @@ class AuthenticationViews(TestCase):
|
|||
response = view(request)
|
||||
self.assertEqual(models.User.objects.count(), 2)
|
||||
|
||||
def test_confirm_email_code_get(self, _):
|
||||
def test_confirm_email_code_get(self, *_):
|
||||
"""there are so many views, this just makes sure it LOADS"""
|
||||
self.settings.require_confirm_email = True
|
||||
self.settings.save()
|
||||
|
@ -311,7 +311,7 @@ class AuthenticationViews(TestCase):
|
|||
self.assertEqual(result.url, "/")
|
||||
self.assertEqual(result.status_code, 302)
|
||||
|
||||
def test_confirm_email_code_get_invalid_code(self, _):
|
||||
def test_confirm_email_code_get_invalid_code(self, *_):
|
||||
"""there are so many views, this just makes sure it LOADS"""
|
||||
self.settings.require_confirm_email = True
|
||||
self.settings.save()
|
||||
|
@ -334,7 +334,7 @@ class AuthenticationViews(TestCase):
|
|||
self.assertFalse(self.local_user.is_active)
|
||||
self.assertEqual(self.local_user.deactivation_reason, "pending")
|
||||
|
||||
def test_confirm_email_get(self, _):
|
||||
def test_confirm_email_get(self, *_):
|
||||
"""there are so many views, this just makes sure it LOADS"""
|
||||
self.settings.require_confirm_email = True
|
||||
self.settings.save()
|
||||
|
|
|
@ -7,6 +7,7 @@ from django.test.client import RequestFactory
|
|||
from bookwyrm import forms, models, views
|
||||
|
||||
|
||||
@patch("bookwyrm.activitystreams.populate_stream_task.delay")
|
||||
class GetStartedViews(TestCase):
|
||||
"""helping new users get oriented"""
|
||||
|
||||
|
@ -46,7 +47,6 @@ class GetStartedViews(TestCase):
|
|||
self.assertEqual(result.status_code, 200)
|
||||
|
||||
@patch("bookwyrm.suggested_users.rerank_suggestions_task.delay")
|
||||
@patch("bookwyrm.activitystreams.populate_stream_task.delay")
|
||||
@patch("bookwyrm.suggested_users.rerank_user_task.delay")
|
||||
def test_profile_view_post(self, *_):
|
||||
"""save basic user details"""
|
||||
|
@ -91,7 +91,6 @@ class GetStartedViews(TestCase):
|
|||
self.assertEqual(result.status_code, 200)
|
||||
|
||||
@patch("bookwyrm.suggested_users.rerank_suggestions_task.delay")
|
||||
@patch("bookwyrm.activitystreams.populate_stream_task.delay")
|
||||
def test_books_view_post(self, _):
|
||||
"""shelve some books"""
|
||||
view = views.GetStartedBooks.as_view()
|
||||
|
|
|
@ -378,7 +378,7 @@ class StatusViews(TestCase):
|
|||
status.refresh_from_db()
|
||||
self.assertFalse(status.deleted)
|
||||
|
||||
def test_handle_delete_status_moderator(self, mock, _):
|
||||
def test_handle_delete_status_moderator(self, mock, *_):
|
||||
"""marks a status as deleted"""
|
||||
view = views.DeleteStatus.as_view()
|
||||
with patch("bookwyrm.activitystreams.add_status_task.delay"):
|
||||
|
|
|
@ -103,8 +103,8 @@ class UserViews(TestCase):
|
|||
self.assertEqual(result.status_code, 200)
|
||||
|
||||
@patch("bookwyrm.suggested_users.rerank_suggestions_task.delay")
|
||||
@patch("bookwyrm.activitystreams.populate_stream_task.delay")
|
||||
def test_followers_page_blocked(self, _):
|
||||
@patch("bookwyrm.activitystreams.populate_stream_task.delay")
|
||||
def test_followers_page_blocked(self, *_):
|
||||
"""there are so many views, this just makes sure it LOADS"""
|
||||
view = views.Followers.as_view()
|
||||
request = self.factory.get("")
|
||||
|
|
Loading…
Reference in a new issue