diff --git a/bookwyrm/forms.py b/bookwyrm/forms.py index 152c2d768..eafbe4071 100644 --- a/bookwyrm/forms.py +++ b/bookwyrm/forms.py @@ -125,6 +125,7 @@ class EditionForm(CustomForm): 'origin_id', 'created_date', 'updated_date', + 'edition_rank', 'authors',# TODO 'parent_work', diff --git a/bookwyrm/templatetags/bookwyrm_tags.py b/bookwyrm/templatetags/bookwyrm_tags.py index ef8e00332..d774a0793 100644 --- a/bookwyrm/templatetags/bookwyrm_tags.py +++ b/bookwyrm/templatetags/bookwyrm_tags.py @@ -149,6 +149,7 @@ def get_mentions(status, user): @register.filter(name='status_preview_name') def get_status_preview_name(obj): + ''' text snippet with book context for a status ''' name = obj.__class__.__name__.lower() if name == 'review': return '%s of %s' % (name, obj.book.title) diff --git a/bookwyrm/tests/test_view_actions.py b/bookwyrm/tests/test_view_actions.py index 3547f39c8..30549bf21 100644 --- a/bookwyrm/tests/test_view_actions.py +++ b/bookwyrm/tests/test_view_actions.py @@ -291,6 +291,20 @@ class ViewActions(TestCase): self.assertEqual(self.local_user.name, 'New Name') + def test_edit_book(self): + ''' lets a user edit a book ''' + self.local_user.groups.add(self.group) + form = forms.EditionForm(instance=self.book) + form.data['title'] = 'New Title' + form.data['last_edited_by'] = self.local_user.id + request = self.factory.post('', form.data) + request.user = self.local_user + with patch('bookwyrm.broadcast.broadcast_task.delay'): + actions.edit_book(request, self.book.id) + self.book.refresh_from_db() + self.assertEqual(self.book.title, 'New Title') + + def test_switch_edition(self): ''' updates user's relationships to a book ''' work = models.Work.objects.create(title='test work')