Refactoring test_char_field
This commit is contained in:
parent
19299598c3
commit
470e54da8d
@ -84,7 +84,7 @@ class ModelTestCase:
|
||||
|
||||
return field
|
||||
|
||||
def _test_char_field(self, field_name, min_length, max_length, must_have={}, must_hot_have={}):
|
||||
def assertCharField(self, field_name, min_length, max_length, must_have={}, must_hot_have={}):
|
||||
'''
|
||||
Tests if the given field is a char field and if its max_length
|
||||
is in min_length and max_legth
|
||||
|
@ -23,7 +23,7 @@ class MapablePointTestCase(ModelTestCase, TestCase):
|
||||
model = MapablePoint
|
||||
|
||||
def test_name(self):
|
||||
self._test_char_field(
|
||||
self.assertCharField(
|
||||
field_name='name',
|
||||
min_length=10,
|
||||
max_length=100
|
||||
|
@ -34,7 +34,7 @@ class PlaceTestCase(SubmittableTestCase, TestCase):
|
||||
|
||||
|
||||
def test_location(self):
|
||||
self._test_char_field(
|
||||
self.assertCharField(
|
||||
field_name='location',
|
||||
min_length=10,
|
||||
max_length=100
|
||||
|
@ -19,7 +19,7 @@ class VoucheTestCase(ModelTestCase, TestCase):
|
||||
)
|
||||
|
||||
def test_voucher_code(self):
|
||||
self._test_char_field(
|
||||
self.assertCharField(
|
||||
'code',
|
||||
10,
|
||||
100,
|
||||
|
Loading…
Reference in New Issue
Block a user