forked from mirrors/bookwyrm
Adds test for dm view with partner
This commit is contained in:
parent
5b192d1b3d
commit
1a30546b99
1 changed files with 18 additions and 0 deletions
|
@ -36,6 +36,13 @@ class FeedViews(TestCase):
|
||||||
local=True,
|
local=True,
|
||||||
localname="mouse",
|
localname="mouse",
|
||||||
)
|
)
|
||||||
|
self.another_user = models.User.objects.create_user(
|
||||||
|
"rat@local.com",
|
||||||
|
"rat@rat.rat",
|
||||||
|
"password",
|
||||||
|
local=True,
|
||||||
|
localname="rat",
|
||||||
|
)
|
||||||
self.book = models.Edition.objects.create(
|
self.book = models.Edition.objects.create(
|
||||||
parent_work=models.Work.objects.create(title="hi"),
|
parent_work=models.Work.objects.create(title="hi"),
|
||||||
title="Example Edition",
|
title="Example Edition",
|
||||||
|
@ -171,6 +178,17 @@ class FeedViews(TestCase):
|
||||||
result.render()
|
result.render()
|
||||||
self.assertEqual(result.status_code, 200)
|
self.assertEqual(result.status_code, 200)
|
||||||
|
|
||||||
|
def test_direct_messages_page_user(self, *_):
|
||||||
|
"""there are so many views, this just makes sure it LOADS"""
|
||||||
|
view = views.DirectMessage.as_view()
|
||||||
|
request = self.factory.get("")
|
||||||
|
request.user = self.local_user
|
||||||
|
result = view(request, "rat")
|
||||||
|
self.assertIsInstance(result, TemplateResponse)
|
||||||
|
result.render()
|
||||||
|
self.assertEqual(result.status_code, 200)
|
||||||
|
self.assertEqual(result.context_data["partner"], self.another_user)
|
||||||
|
|
||||||
@patch("bookwyrm.models.activitypub_mixin.broadcast_task.apply_async")
|
@patch("bookwyrm.models.activitypub_mixin.broadcast_task.apply_async")
|
||||||
@patch("bookwyrm.activitystreams.add_book_statuses_task.delay")
|
@patch("bookwyrm.activitystreams.add_book_statuses_task.delay")
|
||||||
def test_get_suggested_book(self, *_):
|
def test_get_suggested_book(self, *_):
|
||||||
|
|
Loading…
Reference in a new issue