fix changes api
authorRadek Czajka <radoslaw.czajka@nowoczesnapolska.org.pl>
Tue, 17 Apr 2012 11:18:50 +0000 (13:18 +0200)
committerRadek Czajka <radoslaw.czajka@nowoczesnapolska.org.pl>
Tue, 17 Apr 2012 11:18:50 +0000 (13:18 +0200)
apps/api/handlers.py
apps/api/tests.py

index 91a3f4b..437b3be 100644 (file)
@@ -106,7 +106,7 @@ class BookDetails(object):
 
     @classmethod
     def author(cls, book):
-        return ",".join(t[0] for t in book.related_info()['tags']['author'])
+        return ",".join(t[0] for t in book.related_info()['tags'].get('author', []))
 
     @classmethod
     def href(cls, book):
@@ -410,7 +410,7 @@ class CatalogueHandler(BaseHandler):
     def book_dict(book, fields=None):
         all_fields = ['url', 'title', 'description',
                       'gazeta_link', 'wiki_link',
-                      ] + Book.formats + BookMedia.formats + [
+                      ] + Book.formats + BookMedia.formats.keys() + [
                       'parent', 'parent_number',
                       'tags',
                       'license', 'license_description', 'source_name',
index 5a981a2..fe8e70f 100644 (file)
@@ -1,31 +1,26 @@
 # -*- coding: utf-8 -*-
 
-from datetime import datetime
+from os import path
 
+from django.core.files.uploadedfile import SimpleUploadedFile
 from django.test import TestCase
+from django.test.utils import override_settings
 from django.utils import simplejson as json
-from django.conf import settings
 
-from api.helpers import timestamp
 from catalogue.models import Book, Tag
-from picture.tests.utils import RequestFactory
 from picture.forms import PictureImportForm
-from picture.models import Picture, picture_storage
+from picture.models import Picture
 import picture.tests
-from django.core.files.uploadedfile import SimpleUploadedFile
-
-from os import path
 
 
+@override_settings(
+    API_WAIT=-1, 
+    CACHES = {'api': {'BACKEND': 'django.core.cache.backends.dummy.DummyCache'},
+              'default': {'BACKEND': 'django.core.cache.backends.dummy.DummyCache'},
+              'permanent': {'BACKEND': 'django.core.cache.backends.dummy.DummyCache'}}
+)
 class ApiTest(TestCase):
-
-    def setUp(self):
-        self.old_api_wait = settings.API_WAIT
-        settings.API_WAIT = -1
-
-    def tearDown(self):
-        settings.API_WAIT = self.old_api_wait
+    pass
 
 
 class ChangesTest(ApiTest):