From 3295d419bff26b801977e9941012ff7cb7db8845 Mon Sep 17 00:00:00 2001 From: Giebisch Date: Mon, 19 Dec 2022 23:25:43 +0100 Subject: [PATCH] Add Test for Import Limit --- bookwyrm/tests/importers/test_importer.py | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/bookwyrm/tests/importers/test_importer.py b/bookwyrm/tests/importers/test_importer.py index a6ccc60c7..51346f1a1 100644 --- a/bookwyrm/tests/importers/test_importer.py +++ b/bookwyrm/tests/importers/test_importer.py @@ -360,3 +360,16 @@ class GenericImporter(TestCase): self.assertFalse( models.Review.objects.filter(book=self.book, user=self.local_user).exists() ) + + def test_import_limit(self, *_): + """checks if import limit works""" + site_settings = models.SiteSettings.objects.get() + site_settings.import_size_limit = 2 + site_settings.import_limit_reset = 2 + site_settings.save() + + import_job = self.importer.create_job( + self.local_user, self.csv, False, "public" + ) + import_items = models.ImportItem.objects.filter(job=import_job).all() + self.assertEqual(len(import_items), 2)