Fixes incoming shelve activity

This commit is contained in:
Mouse Reeve
2020-12-15 18:57:17 -08:00
parent 948e938040
commit da05b99bb8
5 changed files with 28 additions and 6 deletions

View File

@ -433,6 +433,28 @@ class Incoming(TestCase):
boosted_status=self.status, user=self.remote_user)
incoming.handle_unboost(activity)
def test_handle_add_book(self):
''' shelving a book '''
book = models.Edition.objects.create(
title='Test', remote_id='https://bookwyrm.social/book/37292')
shelf = models.Shelf.objects.create(
user=self.remote_user, name='Test Shelf')
shelf.remote_id = 'https://bookwyrm.social/user/mouse/shelf/to-read'
shelf.save()
activity = {
"id": "https://bookwyrm.social/shelfbook/6189#add",
"type": "Add",
"actor": "hhttps://example.com/users/rat",
"object": "https://bookwyrm.social/book/37292",
"target": "https://bookwyrm.social/user/mouse/shelf/to-read",
"@context": "https://www.w3.org/ns/activitystreams"
}
incoming.handle_add(activity)
self.assertEqual(shelf.books.first(), book)
def test_handle_update_user(self):
''' update an existing user '''
datafile = pathlib.Path(__file__).parent.joinpath(