|
|
@@ -6,8 +6,11 @@ from django_images.models import Thumbnail |
|
|
|
from taggit.models import Tag |
|
|
|
from tastypie.test import ResourceTestCase |
|
|
|
|
|
|
|
from .models import Pin, Image |
|
|
|
from ..users.models import User |
|
|
|
from ..models import Pin, Image |
|
|
|
from ...users.models import User |
|
|
|
|
|
|
|
|
|
|
|
__all__ = ['ImageResourceTest', 'PinResourceTest'] |
|
|
|
|
|
|
|
|
|
|
|
def filter_generator_for(size): |
|
|
@@ -197,6 +200,12 @@ class PinResourceTest(ResourceTestCase): |
|
|
|
self.assertValidJSONResponse(response) |
|
|
|
self.assertEqual(self.deserialize(response)['objects'][0]['id'], pin.id) |
|
|
|
|
|
|
|
def test_get_list_json_filtered(self): |
|
|
|
tag = self.pin_1.tags.all()[0] |
|
|
|
response = self.api_client.get('/api/v1/pin/', format='json', data={'tag': tag}) |
|
|
|
self.assertValidJSONResponse(response) |
|
|
|
self.assertEqual(self.deserialize(response)['objects'][0]['id'], self.pin_1.id) |
|
|
|
|
|
|
|
def test_get_list_json(self): |
|
|
|
user = User.objects.get(pk=1) |
|
|
|
image = Image.objects.get(pk=1) |