test around delete consistency #148
This commit is contained in:
		| @@ -513,7 +513,7 @@ class BaseModel(object): | |||||||
|  |  | ||||||
|     def delete(self): |     def delete(self): | ||||||
|         """ Deletes this instance """ |         """ Deletes this instance """ | ||||||
|         self.__dmlquery__(self.__class__, self, batch=self._batch, timestamp=self._timestamp).delete() |         self.__dmlquery__(self.__class__, self, batch=self._batch, timestamp=self._timestamp, consistency=self.__consistency__).delete() | ||||||
|  |  | ||||||
|     def get_changed_columns(self): |     def get_changed_columns(self): | ||||||
|         """ returns a list of the columns that have been updated since instantiation or save """ |         """ returns a list of the columns that have been updated since instantiation or save """ | ||||||
|   | |||||||
| @@ -76,3 +76,19 @@ class TestConsistency(BaseConsistencyTest): | |||||||
|  |  | ||||||
|         args = m.call_args |         args = m.call_args | ||||||
|         self.assertEqual(ALL, args[0][2]) |         self.assertEqual(ALL, args[0][2]) | ||||||
|  |  | ||||||
|  |  | ||||||
|  |     def test_delete(self): | ||||||
|  |         # ensures we always carry consistency through on delete statements | ||||||
|  |         t = TestConsistencyModel.create(text="bacon and eggs") | ||||||
|  |         t.text = "ham and cheese sandwich" | ||||||
|  |         uid = t.id | ||||||
|  |  | ||||||
|  |         with mock.patch.object(ConnectionPool, 'execute') as m: | ||||||
|  |             t.consistency(ALL).delete() | ||||||
|  |  | ||||||
|  |         with mock.patch.object(ConnectionPool, 'execute') as m: | ||||||
|  |             TestConsistencyModel.objects(id=uid).consistency(ALL).delete() | ||||||
|  |  | ||||||
|  |         args = m.call_args | ||||||
|  |         self.assertEqual(ALL, args[0][2]) | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user
	 Jon Haddad
					Jon Haddad