Shelving tests

This commit is contained in:
Mouse Reeve
2020-10-16 15:07:41 -07:00
parent 75c695b3c6
commit 4f07a567bd
3 changed files with 108 additions and 8 deletions

View File

@ -111,11 +111,16 @@ def handle_shelve(user, book, shelf):
broadcast(user, shelve.to_add_activity(user))
# tell the world about this cool thing that happened
message = {
'to-read': 'wants to read',
'reading': 'started reading',
'read': 'finished reading'
}[shelf.identifier]
try:
message = {
'to-read': 'wants to read',
'reading': 'started reading',
'read': 'finished reading'
}[shelf.identifier]
except KeyError:
# it's a non-standard shelf, don't worry about it
return
status = create_generated_note(user, message, mention_books=[book])
status.save()