Skip to content

Commit

Permalink
Additional tests for finding custom fields feature.
Browse files Browse the repository at this point in the history
  • Loading branch information
sirex committed May 10, 2011
1 parent 7fe1f0f commit f0276fa
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
8 changes: 8 additions & 0 deletions mockups/tests/mockups_test/models.py
Expand Up @@ -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)

Expand Down Expand Up @@ -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)]
Expand Down
2 changes: 2 additions & 0 deletions mockups/tests/mockups_test/tests.py
Expand Up @@ -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):
Expand Down

0 comments on commit f0276fa

Please sign in to comment.