|
@@ -1,15 +1,27 @@
|
1
|
1
|
import unittest
|
2
|
2
|
|
3
|
3
|
from lodel.leapi.datahandlers.datas import Text
|
|
4
|
+from lodel.exceptions import FieldValidationError
|
4
|
5
|
|
5
|
6
|
|
6
|
7
|
class TextTestCase(unittest.TestCase):
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+ def test_base_type_property_value_equals_text(self):
|
|
11
|
+ self.assertEqual(Text.base_type, 'text')
|
7
|
12
|
|
8
|
|
- def test_check_data(self):
|
|
13
|
+
|
|
14
|
+ def test_non_string_value_throws_FieldValidationError(self):
|
|
15
|
+ self.assertRaises(
|
|
16
|
+ FieldValidationError,
|
|
17
|
+ Text()._check_data_value,
|
|
18
|
+ bool
|
|
19
|
+ )
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+ def test_check_data_returns_unchanged_strnig_parameter_if_valid(self):
|
9
|
23
|
test_value = """ Ceci est un texte multiligne pour tester le check
|
10
|
24
|
sur le datahandler
|
11
|
25
|
Text
|
12
|
26
|
"""
|
13
|
|
- test_text = Text()
|
14
|
|
- _, error = test_text.check_data_value(test_value)
|
15
|
|
- self.assertIsNone(error)
|
|
27
|
+ self.assertEqual(Text()._check_data_value(test_value), test_value)
|