mirror of
https://github.com/bookwyrm-social/bookwyrm.git
synced 2024-11-24 02:21:04 +00:00
commit
5e885e7bda
7 changed files with 17 additions and 10 deletions
1
bookwyrm/tests/views/__init__.py
Normal file
1
bookwyrm/tests/views/__init__.py
Normal file
|
@ -0,0 +1 @@
|
|||
from . import *
|
|
@ -45,7 +45,8 @@ class ReadingViews(TestCase):
|
|||
'start_date': '2020-01-05',
|
||||
})
|
||||
request.user = self.local_user
|
||||
views.start_reading(request, self.book.id)
|
||||
with patch('bookwyrm.broadcast.broadcast_task.delay'):
|
||||
views.start_reading(request, self.book.id)
|
||||
|
||||
self.assertEqual(shelf.books.get(), self.book)
|
||||
|
||||
|
@ -73,7 +74,8 @@ class ReadingViews(TestCase):
|
|||
|
||||
request = self.factory.post('')
|
||||
request.user = self.local_user
|
||||
views.start_reading(request, self.book.id)
|
||||
with patch('bookwyrm.broadcast.broadcast_task.delay'):
|
||||
views.start_reading(request, self.book.id)
|
||||
|
||||
self.assertFalse(to_read_shelf.books.exists())
|
||||
self.assertEqual(shelf.books.get(), self.book)
|
||||
|
@ -95,7 +97,9 @@ class ReadingViews(TestCase):
|
|||
'id': readthrough.id,
|
||||
})
|
||||
request.user = self.local_user
|
||||
views.finish_reading(request, self.book.id)
|
||||
|
||||
with patch('bookwyrm.broadcast.broadcast_task.delay'):
|
||||
views.finish_reading(request, self.book.id)
|
||||
|
||||
self.assertEqual(shelf.books.get(), self.book)
|
||||
|
||||
|
|
|
@ -74,7 +74,7 @@ class ShelfViews(TestCase):
|
|||
'name': 'To Read',
|
||||
})
|
||||
request.user = self.local_user
|
||||
view(request, self.local_user.username, shelf.id)
|
||||
view(request, self.local_user.username, shelf.identifier)
|
||||
shelf.refresh_from_db()
|
||||
|
||||
self.assertEqual(shelf.privacy, 'unlisted')
|
||||
|
@ -94,7 +94,7 @@ class ShelfViews(TestCase):
|
|||
'name': 'cool name'
|
||||
})
|
||||
request.user = self.local_user
|
||||
view(request, request.user.username, shelf.id)
|
||||
view(request, request.user.username, shelf.identifier)
|
||||
shelf.refresh_from_db()
|
||||
|
||||
self.assertEqual(shelf.name, 'cool name')
|
||||
|
@ -114,7 +114,7 @@ class ShelfViews(TestCase):
|
|||
'name': 'cool name'
|
||||
})
|
||||
request.user = self.local_user
|
||||
view(request, request.user.username, shelf.id)
|
||||
view(request, request.user.username, shelf.identifier)
|
||||
|
||||
self.assertEqual(shelf.name, 'To Read')
|
||||
|
||||
|
|
|
@ -176,7 +176,8 @@ class StatusViews(TestCase):
|
|||
reply = models.Status.replies(status).first()
|
||||
self.assertEqual(reply.content, '<p>right</p>')
|
||||
self.assertEqual(reply.user, user)
|
||||
self.assertTrue(self.remote_user in reply.mention_users.all())
|
||||
# the mentioned user in the parent post is only included if @'ed
|
||||
self.assertFalse(self.remote_user in reply.mention_users.all())
|
||||
self.assertTrue(self.local_user in reply.mention_users.all())
|
||||
|
||||
def test_find_mentions(self):
|
||||
|
|
|
@ -30,8 +30,8 @@ def start_reading(request, book_id):
|
|||
if readthrough:
|
||||
readthrough.save()
|
||||
|
||||
# create a progress update if we have a page
|
||||
readthrough.create_update()
|
||||
# create a progress update if we have a page
|
||||
readthrough.create_update()
|
||||
|
||||
# shelve the book
|
||||
if request.POST.get('reshelve', True):
|
||||
|
|
|
@ -65,6 +65,7 @@ class Shelf(View):
|
|||
return TemplateResponse(request, 'shelf.html', data)
|
||||
|
||||
@method_decorator(login_required, name='dispatch')
|
||||
# pylint: disable=unused-argument
|
||||
def post(self, request, username, shelf_identifier):
|
||||
''' edit a shelf '''
|
||||
try:
|
||||
|
|
|
@ -73,7 +73,7 @@ class User(View):
|
|||
activities = get_activity_feed(
|
||||
request.user,
|
||||
['public', 'unlisted', 'followers'],
|
||||
queryset=models.Status.objects.filter(user=user)
|
||||
queryset=user.status_set
|
||||
)
|
||||
paginated = Paginator(activities, PAGE_LENGTH)
|
||||
goal = models.AnnualGoal.objects.filter(
|
||||
|
|
Loading…
Reference in a new issue