Browse Source

Added test for multiple references

m.orban 8 years ago
parent
commit
c270977e4e

+ 1
- 0
lodel/leapi/datahandlers/base_classes.py View File

399
         for i,v in enumerate(s_value):
399
         for i,v in enumerate(s_value):
400
             new_val = super()._check_data_value(v)
400
             new_val = super()._check_data_value(v)
401
             value[i]=new_val
401
             value[i]=new_val
402
+            error_list[i]=new_val
402
         logger.debug(value)
403
         logger.debug(value)
403
         if len(error_list) >0:
404
         if len(error_list) >0:
404
             raise FieldValidationError("MultipleRef have for error :", error_list)
405
             raise FieldValidationError("MultipleRef have for error :", error_list)

+ 5
- 5
tests/datahandlers/test_reference.py View File

1
 
1
 
2
 import unittest
2
 import unittest
3
 
3
 
4
-from lodel.leapi.datahandlers.base_classes import Reference
4
+from lodel.leapi.datahandlers.base_classes import Reference, MultipleRef
5
 from leapi.query.utils import init_dyncode
5
 from leapi.query.utils import init_dyncode
6
 from lodel.exceptions import *
6
 from lodel.exceptions import *
7
 from lodel.leapi.leobject import LeObject
7
 from lodel.leapi.leobject import LeObject
44
             self.assertEqual(test_value, value)
44
             self.assertEqual(test_value, value)
45
 
45
 
46
 
46
 
47
-class MultipleRefTestCase(unnittest.case):
47
+class MultipleRefTestCase(unittest.TestCase):
48
 
48
 
49
     def test_multiref_check_data_value_not_iter(self):
49
     def test_multiref_check_data_value_not_iter(self):
50
-        multiref = MultipleRef(3)
51
-        for test_value in [obj3, 15]:
52
-            value = test_ref._check_data_value(test_value)
50
+        test_multiref = MultipleRef(3)
51
+        for test_value in [(obj3, 15)]:
52
+            value = test_multiref._check_data_value(test_value)
53
             self.assertEqual(test_value, value)
53
             self.assertEqual(test_value, value)
54
 
54
 

Loading…
Cancel
Save