diff --git a/api/tests.py b/api/tests.py index 8903e47e..818ff78f 100755 --- a/api/tests.py +++ b/api/tests.py @@ -16,16 +16,16 @@ regluit imports """ import regluit.core.isbn -from regluit.core import bookloader, models +from regluit.core import models from regluit.utils.localdatetime import now from regluit.api import models as apimodels class ApiTests(TestCase): - fixtures = ['initial_data.json'] + fixtures = ['initial_data.json', 'neuromancer.json'] work_id=None def setUp(self): - edition = bookloader.add_by_isbn_from_google(isbn='0441007465') + edition = models.Edition.objects.get(pk=1) self.work_id=edition.work.id campaign = models.Campaign.objects.create( name=edition.work.title, @@ -151,9 +151,9 @@ class ApiTests(TestCase): self.assertEqual(r.status_code, 200) class FeedTests(TestCase): - fixtures = ['initial_data.json'] + fixtures = ['initial_data.json', 'neuromancer.json'] def setUp(self): - edition = bookloader.add_by_isbn_from_google(isbn='0441007465') + edition = models.Edition.objects.get(pk=1) ebook = models.Ebook.objects.create(edition=edition, url='http://example.org/', format='epub', rights='CC BY') self.test_work_id = edition.work.id diff --git a/core/fixtures/neuromancer.json b/core/fixtures/neuromancer.json new file mode 100644 index 00000000..553d54c0 --- /dev/null +++ b/core/fixtures/neuromancer.json @@ -0,0 +1,86 @@ +[ +{ + "fields": { + "edition": 1, + "work": 1, + "type": "goog", + "value": "IDFfMPW32hQC" + }, + "model": "core.identifier", + "pk": 1 +}, +{ + "fields": { + "edition": 1, + "work": 1, + "type": "isbn", + "value": "9780441007462" + }, + "model": "core.identifier", + "pk": 2 +}, +{ + "fields": { + "description": "", + "language": "en", + "title": "Neuromancer", + "created": "2016-12-29T13:14:30.748", + "openlibrary_lookup": null, + "publication_range": null, + "is_free": false, + "age_level": "", + "selected_edition": null, + "featured": null, + "num_wishes": 0 + }, + "model": "core.work", + "pk": 1 +}, +{ + "fields": { + "name": "William Gibson", + "created": "2016-12-29T13:14:30.757" + }, + "model": "core.author", + "pk": 1 +}, +{ + "fields": { + "code": "aut", + "name": "Author" + }, + "model": "core.relation", + "pk": 1 +}, +{ + "fields": { + "edition": 1, + "relation": 1, + "author": 1 + }, + "model": "core.relator", + "pk": 1 +}, +{ + "fields": { + "title": "Neuromancer", + "work": 1, + "created": "2016-12-29T13:14:30.753", + "note": null, + "cover_image": null, + "publication_date": "2000", + "publisher_name": 1, + "unglued": false + }, + "model": "core.edition", + "pk": 1 +}, +{ + "fields": { + "publisher": null, + "name": "Penguin" + }, + "model": "core.publishername", + "pk": 1 +} +] \ No newline at end of file