Updates tests

This commit is contained in:
Mouse Reeve 2022-01-11 08:06:52 -08:00
parent dcf8a8dab9
commit de1bace8f3
3 changed files with 7 additions and 6 deletions

View file

@ -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()

View file

@ -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)

View file

@ -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