From de1bace8f363ee57d15db8968c9af3efed79f48c Mon Sep 17 00:00:00 2001 From: Mouse Reeve Date: Tue, 11 Jan 2022 08:06:52 -0800 Subject: [PATCH] Updates tests --- bookwyrm/tests/views/admin/test_link_domains.py | 1 + bookwyrm/tests/views/admin/test_reports.py | 10 +++++----- bookwyrm/tests/views/books/test_links.py | 2 +- 3 files changed, 7 insertions(+), 6 deletions(-) diff --git a/bookwyrm/tests/views/admin/test_link_domains.py b/bookwyrm/tests/views/admin/test_link_domains.py index 8c972ea1..5d440dc5 100644 --- a/bookwyrm/tests/views/admin/test_link_domains.py +++ b/bookwyrm/tests/views/admin/test_link_domains.py @@ -29,6 +29,7 @@ class LinkDomainViews(TestCase): models.FileLink.objects.create( book=self.book, url="https://beep.com/book/1", + added_by=self.local_user, ) models.SiteSettings.objects.create() diff --git a/bookwyrm/tests/views/admin/test_reports.py b/bookwyrm/tests/views/admin/test_reports.py index 137d17cb..d0f2e9d9 100644 --- a/bookwyrm/tests/views/admin/test_reports.py +++ b/bookwyrm/tests/views/admin/test_reports.py @@ -37,7 +37,7 @@ class ReportViews(TestCase): def test_reports_page(self): """there are so many views, this just makes sure it LOADS""" - view = views.Reports.as_view() + view = views.ReportsAdmin.as_view() request = self.factory.get("") request.user = self.local_user request.user.is_superuser = True @@ -49,7 +49,7 @@ class ReportViews(TestCase): def test_reports_page_with_data(self): """there are so many views, this just makes sure it LOADS""" - view = views.Reports.as_view() + view = views.ReportsAdmin.as_view() request = self.factory.get("") request.user = self.local_user request.user.is_superuser = True @@ -62,7 +62,7 @@ class ReportViews(TestCase): def test_report_page(self): """there are so many views, this just makes sure it LOADS""" - view = views.Report.as_view() + view = views.ReportAdmin.as_view() request = self.factory.get("") request.user = self.local_user request.user.is_superuser = True @@ -76,7 +76,7 @@ class ReportViews(TestCase): def test_report_comment(self): """comment on a report""" - view = views.Report.as_view() + view = views.ReportAdmin.as_view() request = self.factory.post("", {"note": "hi"}) request.user = self.local_user request.user.is_superuser = True @@ -97,7 +97,7 @@ class ReportViews(TestCase): request = self.factory.post("", form.data) request.user = self.local_user - views.make_report(request) + views.Report.as_view()(request) report = models.Report.objects.get() self.assertEqual(report.reporter, self.local_user) diff --git a/bookwyrm/tests/views/books/test_links.py b/bookwyrm/tests/views/books/test_links.py index 1961bde0..bdd9aaf4 100644 --- a/bookwyrm/tests/views/books/test_links.py +++ b/bookwyrm/tests/views/books/test_links.py @@ -66,7 +66,7 @@ class LinkViews(TestCase): form.data["url"] = "https://www.example.com" form.data["filetype"] = "HTML" form.data["book"] = self.book.id - form.data["added_by"] = self.local_user + form.data["added_by"] = self.local_user.id request = self.factory.post("", form.data) request.user = self.local_user