Permalink
Browse files

Additional tests for finding custom fields feature.

  • Loading branch information...
1 parent 7fe1f0f commit f0276fa148ca17916e263dc25bc934cbd82d6f0f @sirex sirex committed May 10, 2011
Showing with 10 additions and 0 deletions.
  1. +8 −0 mockups/tests/mockups_test/models.py
  2. +2 −0 mockups/tests/mockups_test/tests.py
@@ -11,6 +11,12 @@ def y2k():
return datetime(2000, 1, 1)
+class MyCustomField(models.CharField):
+ def __init__(self, *args, **kwargs):
+ kwargs.setdefault('max_length', 50)
+ super(MyCustomField, self).__init__(*args, **kwargs)
+
+
class SimpleModel(models.Model):
name = models.CharField(max_length=50)
@@ -69,6 +75,8 @@ class BasicModel(models.Model):
filepathfield = models.FilePathField(path=filepath)
mfilepathfield = models.FilePathField(path=filepath, match=r'^.+\.py$')
+ customfield = MyCustomField()
+
class UniqueTestModel(models.Model):
CHOICES = [(i,i) for i in range(10)]
@@ -54,6 +54,8 @@ def test_constraints(self):
self.assertTrue(' ' not in obj.emailfield)
self.assertTrue(obj.ipaddressfield.count('.'), 3)
self.assertTrue(len(obj.ipaddressfield) >= 7)
+ self.assertTrue(len(obj.customfield) > 0)
+ self.assertEqual(type(obj.customfield), unicode)
self.assertEqual(BasicModel.objects.count(), 100)
def test_factory(self):

0 comments on commit f0276fa

Please sign in to comment.