mirror of
https://github.com/pinry/pinry.git
synced 2025-11-15 09:25:50 +01:00
Reorganize core package tests into modules
This commit is contained in:
2
pinry/core/tests/__init__.py
Normal file
2
pinry/core/tests/__init__.py
Normal file
@@ -0,0 +1,2 @@
|
||||
from .api import *
|
||||
from .forms import *
|
||||
@@ -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)
|
||||
11
pinry/core/tests/forms.py
Normal file
11
pinry/core/tests/forms.py
Normal file
@@ -0,0 +1,11 @@
|
||||
from django.test import TestCase
|
||||
from ..forms import ImageForm
|
||||
|
||||
|
||||
__all__ = ['ImageFormTest']
|
||||
|
||||
class ImageFormTest(TestCase):
|
||||
def test_image_field_prefix(self):
|
||||
"""Assert that the image field has a proper name"""
|
||||
form = ImageForm()
|
||||
self.assertInHTML("<input id='id_qqfile' name='qqfile' type='file' />", str(form))
|
||||
Reference in New Issue
Block a user