Fix test_export

This commit is contained in:
Carlos Camara 2024-01-16 08:12:24 +00:00
parent 854eb36618
commit ddbda3ab9c

View file

@ -56,11 +56,12 @@ class ExportViews(TestCase):
def test_export_file(self, *_):
"""simple export"""
models.ShelfBook.objects.create(
shelfbook = models.ShelfBook.objects.create(
shelf=self.local_user.shelf_set.first(),
user=self.local_user,
book=self.book,
)
book_date = str.encode(f"{shelfbook.shelved_date.date()}")
request = self.factory.post("")
request.user = self.local_user
export = views.Export.as_view()(request)
@ -69,7 +70,7 @@ class ExportViews(TestCase):
# pylint: disable=line-too-long
self.assertEqual(
export.content,
b"title,author_text,remote_id,openlibrary_key,inventaire_id,librarything_key,goodreads_key,bnf_id,viaf,wikidata,asin,aasin,isfdb,isbn_10,isbn_13,oclc_number,start_date,finish_date,stopped_date,rating,review_name,review_cw,review_content,review_published,shelf,shelf_name,shelf_date\r\nTest Book,,"
+ self.book.remote_id.encode("utf-8")
+ b",,,,,beep,,,,,,123456789X,9781234567890,,,,,,,,,,,,\r\n",
b"title,author_text,remote_id,openlibrary_key,inventaire_id,librarything_key,goodreads_key,bnf_id,viaf,wikidata,asin,aasin,isfdb,isbn_10,isbn_13,oclc_number,start_date,finish_date,stopped_date,rating,review_name,review_cw,review_content,review_published,shelf,shelf_name,shelf_date\r\n"
+ b"Test Book,,%b,,,,,beep,,,,,,123456789X,9781234567890,,,,,,,,,,to-read,To Read,%b\r\n"
% (self.book.remote_id.encode("utf-8"), book_date),
)