|
@@ -66,6 +66,16 @@ class LeRelationTestCase(TestCase):
|
66
|
66
|
for i in range(3):
|
67
|
67
|
self.assertEqual(filter_res[i], res[i], "%s != %s"%(filter_res, res))
|
68
|
68
|
|
|
69
|
+ @unittest.skip("Wait LeRelation._prepare_filters() and LeRelation.delete() to unskip")
|
|
70
|
+ @patch('leapi.datasources.dummy.DummyDatasource.delete')
|
|
71
|
+ def test_delete(self, dsmock):
|
|
72
|
+ """ Testing LeHierarch insert method """
|
|
73
|
+ from dyncode import LeCrud, Publication, Numero, Personnes, LeObject, Rubrique, LeHierarch, LeRelation
|
|
74
|
+
|
|
75
|
+ LeRelation.delete([LeRelation.sup_filter(Numero(42)), 'nature = "parent"'], 'LeHierarch')
|
|
76
|
+ dsmock.assert_called_once_with(LeHierarch, [('lesup', '=', Numero(42)), ('nature','=','parent')])
|
|
77
|
+ dsmock.reset_mock()
|
|
78
|
+
|
69
|
79
|
|
70
|
80
|
class LeHierarch(LeRelationTestCase):
|
71
|
81
|
|
|
@@ -116,6 +126,7 @@ class LeHierarch(LeRelationTestCase):
|
116
|
126
|
@unittest.skip("Wait for LeRelation._prepare_filters() to unskip")
|
117
|
127
|
@patch('leapi.datasources.dummy.DummyDatasource.insert')
|
118
|
128
|
def test_insert(self, dsmock):
|
|
129
|
+ """ Testing LeHierarch insert method """
|
119
|
130
|
from dyncode import LeCrud, Publication, Numero, Personnes, LeObject, Rubrique, LeHierarch, LeRelation
|
120
|
131
|
queries = [
|
121
|
132
|
{
|
|
@@ -147,6 +158,27 @@ class LeHierarch(LeRelationTestCase):
|
147
|
158
|
LeRelation.insert(query, 'LeHierarch')
|
148
|
159
|
dsmock.assert_called_once_with(LeHierarch, **query)
|
149
|
160
|
dsmock.reset_mock()
|
|
161
|
+
|
|
162
|
+
|
|
163
|
+ @unittest.skip("Wait for LeRelation.delete()")
|
|
164
|
+ @patch('leapi.datasources.dummy.DummyDatasource.delete')
|
|
165
|
+ def test_delete(self, dsmock):
|
|
166
|
+ """ Testing LeHierarch insert method """
|
|
167
|
+ from dyncode import LeCrud, Publication, Numero, Personnes, LeObject, Rubrique, LeHierarch, LeRelation
|
|
168
|
+ rel = LeHierarch(10)
|
|
169
|
+ rel.delete()
|
|
170
|
+ dsmock.assert_called_once_with(LeHierarch, [(LeHierarch.uidname(), '=', 10)], [])
|
|
171
|
+
|
|
172
|
+
|
|
173
|
+ @unittest.skip("Wait for LeRelation.update() to unskip")
|
|
174
|
+ @patch('leapi.datasources.dummy.DummyDatasource.insert')
|
|
175
|
+ def test_update(self, dsmock):
|
|
176
|
+ """ test LeHierach update method"""
|
|
177
|
+ from dyncode import LeHierarch
|
|
178
|
+ with self.assertRaises(NotImplementedError):
|
|
179
|
+ LeHierarch.update({})
|
|
180
|
+
|
|
181
|
+
|
150
|
182
|
|
151
|
183
|
class LeRel2TypeTestCase(LeRelationTestCase):
|
152
|
184
|
pass
|