Yann Weber 8 lat temu
rodzic
commit
9b5ba54a1e
1 zmienionych plików z 14 dodań i 5 usunięć
  1. 14
    5
      tests/leapi/test_leobject.py

+ 14
- 5
tests/leapi/test_leobject.py Wyświetl plik

@@ -119,14 +119,17 @@ class LeObjectQueryMockTestCase(unittest.TestCase):
119 119
         with patch.object(
120 120
             LeInsertQuery, '__init__', return_value = None) as mock_init:
121 121
 
122
-            dyncode.Person.insert(datas)
123
-            mock_insert.assert_called_once_with(dyncode.Person)
122
+            try:
123
+                dyncode.Person.insert(datas)
124
+            except AttributeError:
125
+                pass #Because of mock
126
+            mock_init.assert_called_once_with(dyncode.Person)
124 127
 
125 128
         with patch.object(
126 129
             LeInsertQuery, 'execute', return_value = 42) as mock_insert:
127 130
 
128 131
             ret = dyncode.Person.insert(datas)
129
-            self.AssertEqual(ret, 42, 'Bad return value forwarding')
132
+            self.assertEqual(ret, 42, 'Bad return value forwarding')
130 133
             mock_insert.assert_called_once_with(datas)
131 134
     
132 135
     def test_delete(self):
@@ -137,7 +140,10 @@ class LeObjectQueryMockTestCase(unittest.TestCase):
137 140
 
138 141
             inst = dyncode.Person(
139 142
                 lodel_id = 1, firstname = "foo", lastname = "bar")
140
-            inst.delete()
143
+            try:
144
+                inst.delete()
145
+            except AttributeError:
146
+                pass
141 147
             mock_init.assert_called_once_with(
142 148
                 dyncode.Person, [('lodel_id', '=', 1)])
143 149
 
@@ -157,7 +163,10 @@ class LeObjectQueryMockTestCase(unittest.TestCase):
157 163
         with patch.object(
158 164
             LeDeleteQuery, '__init__', return_value = None) as mock_init:
159 165
             
160
-            dyncode.Person.delete_bundle(['lodel_id > 1'])
166
+            try:
167
+                dyncode.Person.delete_bundle(['lodel_id > 1'])
168
+            except AttributeError:
169
+                pass
161 170
             mock_init.assert_called_once_with(
162 171
                 dyncode.Person, ['lodel_id > 1'])
163 172
 

Loading…
Anuluj
Zapisz