Merge branch 'master' of github.com:Gluejar/regluit into ry

pull/1/head
Raymond Yee 2012-02-21 15:52:48 -08:00
commit c970754cea
4 changed files with 15 additions and 10 deletions

View File

@ -23,6 +23,7 @@ from celery.task import chord
from time import sleep from time import sleep
from math import factorial from math import factorial
from urlparse import parse_qs, urlparse
class BookLoaderTests(TestCase): class BookLoaderTests(TestCase):
@ -54,7 +55,7 @@ class BookLoaderTests(TestCase):
e = models.Edition(title=w.title,work=w) e = models.Edition(title=w.title,work=w)
e.save() e.save()
models.Identifier(type='isbn', value='9780226032030', work=w, edition=e).save() models.Identifier(type='isbn', value='9780226032030', work=w, edition=e).save()
bookloader.update_edition(e) bookloader.update_edition(e)
self.assertEqual(e.work.language, 'en') self.assertEqual(e.work.language, 'en')
self.assertEqual(e.title, 'Forbidden journeys') self.assertEqual(e.title, 'Forbidden journeys')
@ -223,18 +224,22 @@ class BookLoaderTests(TestCase):
#ebook_epub = edition.ebooks.all()[0] #ebook_epub = edition.ebooks.all()[0]
ebook_epub = edition.ebooks.filter(format='epub')[0] ebook_epub = edition.ebooks.filter(format='epub')[0]
self.assertEqual(ebook_epub.format, 'epub') self.assertEqual(ebook_epub.format, 'epub')
self.assertEqual(ebook_epub.url, 'http://books.google.com/books/download/The_Latin_language.epub?id=U3FXAAAAYAAJ&ie=ISO-8859-1&output=epub&source=gbs_api') #self.assertEqual(ebook_epub.url, 'http://books.google.com/books/download/The_Latin_language.epub?id=U3FXAAAAYAAJ&ie=ISO-8859-1&output=epub&source=gbs_api')
self.assertEqual(parse_qs(urlparse(ebook_epub.url).query).get("id"), ['U3FXAAAAYAAJ'])
self.assertEqual(parse_qs(urlparse(ebook_epub.url).query).get("output"), ['epub'])
self.assertEqual(ebook_epub.provider, 'google') self.assertEqual(ebook_epub.provider, 'google')
ebook_pdf = edition.ebooks.filter(format='pdf')[0] ebook_pdf = edition.ebooks.filter(format='pdf')[0]
self.assertEqual(ebook_pdf.format, 'pdf') self.assertEqual(ebook_pdf.format, 'pdf')
self.assertEqual(ebook_pdf.url, 'http://books.google.com/books/download/The_Latin_language.pdf?id=U3FXAAAAYAAJ&ie=ISO-8859-1&output=pdf&sig=ACfU3U2yLt3nmTncB8ozxOWUc4iHKUznCA&source=gbs_api') #self.assertEqual(ebook_pdf.url, 'http://books.google.com/books/download/The_Latin_language.pdf?id=U3FXAAAAYAAJ&ie=ISO-8859-1&output=pdf&sig=ACfU3U2yLt3nmTncB8ozxOWUc4iHKUznCA&source=gbs_api')
self.assertEqual(parse_qs(urlparse(ebook_pdf.url).query).get("id"), ['U3FXAAAAYAAJ'])
self.assertEqual(parse_qs(urlparse(ebook_pdf.url).query).get("output"), ['pdf'])
self.assertEqual(ebook_pdf.provider, 'google') self.assertEqual(ebook_pdf.provider, 'google')
w = edition.work w = edition.work
self.assertEqual(w.first_epub().url, "http://books.google.com/books/download/The_Latin_language.epub?id=U3FXAAAAYAAJ&ie=ISO-8859-1&output=epub&source=gbs_api") self.assertEqual(w.first_epub().url, ebook_epub.url)
self.assertEqual(w.first_pdf().url, "http://books.google.com/books/download/The_Latin_language.pdf?id=U3FXAAAAYAAJ&ie=ISO-8859-1&output=pdf&sig=ACfU3U2yLt3nmTncB8ozxOWUc4iHKUznCA&source=gbs_api") self.assertEqual(w.first_pdf().url, ebook_pdf.url)
self.assertEqual(w.first_epub_url(), "http://books.google.com/books/download/The_Latin_language.epub?id=U3FXAAAAYAAJ&ie=ISO-8859-1&output=epub&source=gbs_api") self.assertEqual(w.first_epub_url(), ebook_epub.url)
self.assertEqual(w.first_pdf_url(), "http://books.google.com/books/download/The_Latin_language.pdf?id=U3FXAAAAYAAJ&ie=ISO-8859-1&output=pdf&sig=ACfU3U2yLt3nmTncB8ozxOWUc4iHKUznCA&source=gbs_api") self.assertEqual(w.first_pdf_url(), ebook_pdf.url)
def test_add_no_ebook(self): def test_add_no_ebook(self):
# this edition lacks an ebook, but we should still be able to load it # this edition lacks an ebook, but we should still be able to load it

View File

@ -25,7 +25,7 @@
<div id="user-block1"> <div id="user-block1">
<div id="block-intro-text"><span class="special-user-name">{{ facet|capfirst }}</span></div> <div id="block-intro-text"><span class="special-user-name">{{ facet|capfirst }}</span></div>
</div> </div>
<div class="user-block2">With your help we're raising money to buy the right to give these books to the world. <div class="user-block2">With your help we're raising money to buy the rights to give these books to the world.
</div> </div>
<div class="user-block3"> <div class="user-block3">
<div class="user-block"> <div class="user-block">

View File

@ -28,7 +28,7 @@ comments rss?
<div id="user-block1"> <div id="user-block1">
<div id="block-intro-text"><span class="special-user-name">Latest Comments</span></div> <div id="block-intro-text"><span class="special-user-name">Latest Comments</span></div>
</div> </div>
<div class="user-block2"><span class="user-short-info">With your help we're raising money to buy the right to give these books to the world.</span> <div class="user-block2"><span class="user-short-info">With your help we're raising money to buy the rights to give these books to the world.</span>
</div> </div>
<div class="user-block3"> <div class="user-block3">
</div> </div>

View File

@ -27,7 +27,7 @@
<div id="user-block1"> <div id="user-block1">
<div id="block-intro-text"><span class="special-user-name">{{ facet|capfirst }}</span></div> <div id="block-intro-text"><span class="special-user-name">{{ facet|capfirst }}</span></div>
</div> </div>
<div class="user-block2"><span class="user-short-info">With your help we're raising money to buy the right to give these books to the world.</span> <div class="user-block2"><span class="user-short-info">With your help we're raising money to buy the rights to give these books to the world.</span>
</div> </div>
<div class="user-block3"> <div class="user-block3">
</div> </div>