forked from mirrors/bookwyrm
Fixes test for login redirected view
This commit is contained in:
parent
47dbcc3af0
commit
b7fb55e6ad
1 changed files with 11 additions and 15 deletions
|
@ -91,11 +91,13 @@ class ListViews(TestCase):
|
||||||
result.render()
|
result.render()
|
||||||
self.assertEqual(result.status_code, 200)
|
self.assertEqual(result.status_code, 200)
|
||||||
|
|
||||||
def test_bookmarked_lists_page(self):
|
def test_saved_lists_page(self):
|
||||||
"""there are so many views, this just makes sure it LOADS"""
|
"""there are so many views, this just makes sure it LOADS"""
|
||||||
view = views.BookmarkedLists.as_view()
|
view = views.SavedLists.as_view()
|
||||||
with patch("bookwyrm.models.activitypub_mixin.broadcast_task.delay"):
|
with patch("bookwyrm.models.activitypub_mixin.broadcast_task.delay"):
|
||||||
booklist = models.List.objects.create(name="Public list", user=self.local_user)
|
booklist = models.List.objects.create(
|
||||||
|
name="Public list", user=self.local_user
|
||||||
|
)
|
||||||
models.List.objects.create(
|
models.List.objects.create(
|
||||||
name="Private list", privacy="direct", user=self.local_user
|
name="Private list", privacy="direct", user=self.local_user
|
||||||
)
|
)
|
||||||
|
@ -109,9 +111,9 @@ class ListViews(TestCase):
|
||||||
self.assertEqual(result.status_code, 200)
|
self.assertEqual(result.status_code, 200)
|
||||||
self.assertEqual(result.context_data["lists"].object_list, [booklist])
|
self.assertEqual(result.context_data["lists"].object_list, [booklist])
|
||||||
|
|
||||||
def test_bookmarked_lists_page_empty(self):
|
def test_saved_lists_page_empty(self):
|
||||||
"""there are so many views, this just makes sure it LOADS"""
|
"""there are so many views, this just makes sure it LOADS"""
|
||||||
view = views.BookmarkedLists.as_view()
|
view = views.SavedLists.as_view()
|
||||||
with patch("bookwyrm.models.activitypub_mixin.broadcast_task.delay"):
|
with patch("bookwyrm.models.activitypub_mixin.broadcast_task.delay"):
|
||||||
models.List.objects.create(name="Public list", user=self.local_user)
|
models.List.objects.create(name="Public list", user=self.local_user)
|
||||||
models.List.objects.create(
|
models.List.objects.create(
|
||||||
|
@ -126,9 +128,9 @@ class ListViews(TestCase):
|
||||||
self.assertEqual(result.status_code, 200)
|
self.assertEqual(result.status_code, 200)
|
||||||
self.assertEqual(result.context_data["lists"].object_list, [])
|
self.assertEqual(result.context_data["lists"].object_list, [])
|
||||||
|
|
||||||
def test_bookmarked_lists_page_logged_out(self):
|
def test_saved_lists_page_logged_out(self):
|
||||||
"""logged out bookmarked lists"""
|
"""logged out saved lists"""
|
||||||
view = views.BookmarkedLists.as_view()
|
view = views.SavedLists.as_view()
|
||||||
request = self.factory.get("")
|
request = self.factory.get("")
|
||||||
request.user = self.anonymous_user
|
request.user = self.anonymous_user
|
||||||
|
|
||||||
|
@ -372,15 +374,9 @@ class ListViews(TestCase):
|
||||||
def test_user_lists_page_logged_out(self):
|
def test_user_lists_page_logged_out(self):
|
||||||
"""there are so many views, this just makes sure it LOADS"""
|
"""there are so many views, this just makes sure it LOADS"""
|
||||||
view = views.UserLists.as_view()
|
view = views.UserLists.as_view()
|
||||||
with patch("bookwyrm.models.activitypub_mixin.broadcast_task.delay"):
|
|
||||||
models.List.objects.create(name="Public list", user=self.local_user)
|
|
||||||
models.List.objects.create(
|
|
||||||
name="Private list", privacy="direct", user=self.local_user
|
|
||||||
)
|
|
||||||
request = self.factory.get("")
|
request = self.factory.get("")
|
||||||
request.user = self.anonymous_user
|
request.user = self.anonymous_user
|
||||||
|
|
||||||
result = view(request, self.local_user.username)
|
result = view(request, self.local_user.username)
|
||||||
self.assertIsInstance(result, TemplateResponse)
|
|
||||||
result.render()
|
result.render()
|
||||||
self.assertEqual(result.status_code, 200)
|
self.assertEqual(result.status_code, 302)
|
||||||
|
|
Loading…
Reference in a new issue