Permalink
Browse files

test is_file_field template tag

  • Loading branch information...
1 parent e43a431 commit c45b96af5b7ee8400d0f6ad209e1833f11b2a416 @zbyte64 zbyte64 committed May 16, 2012
Showing with 35 additions and 4 deletions.
  1. +1 −0 directupload/tests/__init__.py
  2. +21 −0 directupload/tests/directupload_tags.py
  3. +1 −0 requirements.txt
  4. +12 −4 tox.ini
@@ -1,2 +1,3 @@
from views import *
from admin import *
+from directupload_tags import *
@@ -0,0 +1,21 @@
+from django.test import TestCase
+from django import forms
+
+from django.db import models
+
+class TestModel(models.Model):
+ char_field = models.CharField(max_length=20)
+ file_field = models.FileField(upload_to='folder')
+
+class TestForm(forms.ModelForm):
+ class Meta:
+ model = TestModel
+
+
+class DirectUploadTagsTestCase(TestCase):
+ def test_is_file_field(self):
+ from directupload.templatetags.directupload_tags import is_file_field
+ form = TestForm()
+ self.assertTrue(is_file_field(form['file_field'], TestModel))
+ self.assertFalse(is_file_field(form['char_field'], TestModel))
+
View
@@ -0,0 +1 @@
+django-classy-tags
View
16 tox.ini
@@ -10,17 +10,25 @@ commands = python setup.py test
[testenv:py26_django13]
basepython = python2.6
-deps = Django==1.3.1, <1.4
+deps =
+ Django==1.3.1, <1.4
+ -r{toxinidir}/requirements.txt
[testenv:py26_django14]
basepython = python2.6
-deps = Django>=1.4, <1.5
+deps =
+ Django>=1.4, <1.5
+ -r{toxinidir}/requirements.txt
[testenv:py27_django13]
basepython = python2.7
-deps = Django==1.3.1, <1.4
+deps =
+ Django==1.3.1, <1.4
+ -r{toxinidir}/requirements.txt
[testenv:py27_django14]
basepython = python2.7
-deps = Django>=1.4, <1.5
+deps =
+ Django>=1.4, <1.5
+ -r{toxinidir}/requirements.txt

0 comments on commit c45b96a

Please sign in to comment.