mirror of
https://github.com/bookwyrm-social/bookwyrm.git
synced 2024-11-26 03:21:05 +00:00
Add test
This commit is contained in:
parent
0001d6e92a
commit
5f81be74cb
1 changed files with 6 additions and 3 deletions
|
@ -50,10 +50,13 @@ class UpdateViews(TestCase):
|
|||
request = self.factory.get("")
|
||||
request.user = self.local_user
|
||||
|
||||
with patch("bookwyrm.activitystreams.ActivityStream.get_unread_count") as mock:
|
||||
mock.return_value = 3
|
||||
with patch("bookwyrm.activitystreams.ActivityStream.get_unread_count") as mock_count:
|
||||
with patch("bookwyrm.activitystreams.ActivityStream.get_unread_count_by_status_type") as mock_count_by_status:
|
||||
mock_count.return_value = 3
|
||||
mock_count_by_status.return_value = {"review": 5}
|
||||
result = views.get_unread_status_count(request, "home")
|
||||
|
||||
self.assertIsInstance(result, JsonResponse)
|
||||
data = json.loads(result.getvalue())
|
||||
self.assertEqual(data["count"], 3)
|
||||
self.assertEqual(data["count_by_type"]["review"], 5)
|
||||
|
|
Loading…
Reference in a new issue