Merge branch 'main' into production

This commit is contained in:
Mouse Reeve 2020-12-17 13:56:45 -08:00
commit b36cf5a7b8
2 changed files with 4 additions and 1 deletions

View file

@ -63,7 +63,7 @@ class Book(ActivitypubMixin, BookWyrmModel):
def edition_info(self): def edition_info(self):
''' properties of this edition, as a string ''' ''' properties of this edition, as a string '''
items = [ items = [
self.physical_format, self.physical_format if hasattr(self, 'physical_format') else None,
self.languages[0] + ' language' if self.languages and \ self.languages[0] + ' language' if self.languages and \
self.languages[0] != 'English' else None, self.languages[0] != 'English' else None,
str(self.published_date.year) if self.published_date else None, str(self.published_date.year) if self.published_date else None,

View file

@ -473,11 +473,14 @@ class Incoming(TestCase):
'data/fr_edition.json') 'data/fr_edition.json')
bookdata = json.loads(datafile.read_bytes()) bookdata = json.loads(datafile.read_bytes())
models.Work.objects.create(
title='Test Work', remote_id='https://bookwyrm.social/book/5988')
book = models.Edition.objects.create( book = models.Edition.objects.create(
title='Test Book', remote_id='https://bookwyrm.social/book/5989') title='Test Book', remote_id='https://bookwyrm.social/book/5989')
del bookdata['authors'] del bookdata['authors']
self.assertEqual(book.title, 'Test Book') self.assertEqual(book.title, 'Test Book')
with patch( with patch(
'bookwyrm.activitypub.base_activity.set_related_field.delay'): 'bookwyrm.activitypub.base_activity.set_related_field.delay'):
incoming.handle_update_edition({'object': bookdata}) incoming.handle_update_edition({'object': bookdata})