api tests now run on a fixture
parent
f725998dd8
commit
fffd5012ad
10
api/tests.py
10
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
|
||||
|
||||
|
|
|
@ -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
|
||||
}
|
||||
]
|
Loading…
Reference in New Issue