Merge branch 'master' into instant_charge

pull/1/head
Raymond Yee 2013-06-24 09:18:52 -07:00
commit f6499d7dc5
2 changed files with 7 additions and 6 deletions

View File

@ -40,8 +40,8 @@ class BookLoaderTests(TestCase):
# edition # edition
edition = bookloader.add_by_isbn('0441007465') edition = bookloader.add_by_isbn('0441007465')
self.assertEqual(edition.title, 'Neuromancer') self.assertEqual(edition.title, 'Neuromancer')
self.assertEqual(edition.publication_date, u'2000-07-01') self.assertEqual(edition.publication_date, u'2000')
self.assertEqual(edition.publisher, u'Ace Trade') self.assertEqual(edition.publisher, u'Penguin')
self.assertEqual(edition.isbn_10, '0441007465') self.assertEqual(edition.isbn_10, '0441007465')
self.assertEqual(edition.isbn_13, '9780441007462') self.assertEqual(edition.isbn_13, '9780441007462')
self.assertEqual(edition.googlebooks_id, 'IDFfMPW32hQC') self.assertEqual(edition.googlebooks_id, 'IDFfMPW32hQC')
@ -64,8 +64,8 @@ class BookLoaderTests(TestCase):
self.assertEqual(edition.work.publishers().count(), 1) self.assertEqual(edition.work.publishers().count(), 1)
old_pub_name.publisher = pub old_pub_name.publisher = pub
old_pub_name.save() old_pub_name.save()
edition.set_publisher(u'Ace Trade') edition.set_publisher(u'Penguin')
self.assertEqual(edition.publisher, u'test publisher name') # Ace Trade has been aliased self.assertEqual(edition.publisher, u'test publisher name') # Penguin has been aliased
# locale in language # locale in language
edition = bookloader.add_by_isbn('9787500676911') edition = bookloader.add_by_isbn('9787500676911')
self.assertEqual(edition.work.language, 'zh') self.assertEqual(edition.work.language, 'zh')
@ -674,7 +674,7 @@ class DownloadPageTest(TestCase):
anon_client = Client() anon_client = Client()
response = anon_client.get("/work/%s/download/" % w.id, follow=True) response = anon_client.get("/work/%s/download/" % w.id, follow=True)
self.assertContains(response, "/download_ebook/%s/"% eb1.id, count=4) #the extra is readmill self.assertContains(response, "/download_ebook/%s/"% eb1.id, count=3) # no extra now, readmill not for google books?
self.assertContains(response, "/download_ebook/%s/"% eb2.id, count=3) self.assertContains(response, "/download_ebook/%s/"% eb2.id, count=3)

View File

@ -2353,7 +2353,8 @@ def download(request, work_id):
other_ebooks = work.ebooks().filter(edition__unglued=False) other_ebooks = work.ebooks().filter(edition__unglued=False)
try: try:
readmill_epub_ebook = work.ebooks().filter(format='epub').exclude(provider='Google Books')[0] readmill_epub_ebook = work.ebooks().filter(format='epub').exclude(provider='Google Books')[0]
readmill_epub_url = settings.BASE_URL_SECURE + reverse('download_ebook',args=[readmill_epub_ebook.id]) #readmill_epub_url = settings.BASE_URL_SECURE + reverse('download_ebook',args=[readmill_epub_ebook.id])
readmill_epub_url = readmill_epub_ebook.url
except: except:
readmill_epub_url = None readmill_epub_url = None