ソースを参照

Reorganize core package tests into modules

tags/v1.0.0
Krzysztof Klimonda 11年前
コミット
03e05906f8
3個のファイルの変更24行の追加2行の削除
  1. +2
    -0
      pinry/core/tests/__init__.py
  2. +11
    -2
      pinry/core/tests/api.py
  3. +11
    -0
      pinry/core/tests/forms.py

+ 2
- 0
pinry/core/tests/__init__.py ファイルの表示

@@ -0,0 +1,2 @@
from .api import *
from .forms import *

pinry/core/tests.py → pinry/core/tests/api.py ファイルの表示

@@ -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
- 0
pinry/core/tests/forms.py ファイルの表示

@@ -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))

読み込み中…
キャンセル
保存