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