diff --git a/tests/integration/cqlengine/query/test_batch_query.py b/tests/integration/cqlengine/query/test_batch_query.py index d9dc33c2..4a3e2131 100644 --- a/tests/integration/cqlengine/query/test_batch_query.py +++ b/tests/integration/cqlengine/query/test_batch_query.py @@ -187,13 +187,13 @@ class BatchQueryTests(BaseCassEngTestCase): self.assertEqual(0, len(obj)) def test_batch_execute_timeout(self): - with mock.patch.object(Session, 'execute', autospec=True) as mock_execute: + with mock.patch.object(Session, 'execute') as mock_execute: with BatchQuery(timeout=1) as b: BatchQueryLogModel.batch(b).create(k=2, v=2) - mock_execute.assert_called_once_with(mock.ANY, mock.ANY, mock.ANY, timeout=1) + self.assertEqual(mock_execute.call_args[-1]['timeout'], 1) def test_batch_execute_no_timeout(self): - with mock.patch.object(Session, 'execute', autospec=True) as mock_execute: + with mock.patch.object(Session, 'execute') as mock_execute: with BatchQuery() as b: BatchQueryLogModel.batch(b).create(k=2, v=2) - mock_execute.assert_called_once_with(mock.ANY, mock.ANY, mock.ANY, timeout=NOT_SET) + self.assertEqual(mock_execute.call_args[-1]['timeout'], NOT_SET) diff --git a/tests/integration/cqlengine/query/test_queryset.py b/tests/integration/cqlengine/query/test_queryset.py index 5c2b76f9..7bb101b9 100644 --- a/tests/integration/cqlengine/query/test_queryset.py +++ b/tests/integration/cqlengine/query/test_queryset.py @@ -712,19 +712,19 @@ class PageQueryTests(BaseCassEngTestCase): class ModelQuerySetTimeoutTestCase(BaseQuerySetUsage): def test_default_timeout(self): - with mock.patch.object(Session, 'execute', autospec=True) as mock_execute: + with mock.patch.object(Session, 'execute') as mock_execute: list(TestModel.objects()) - mock_execute.assert_called_once_with(mock.ANY, mock.ANY, mock.ANY, timeout=NOT_SET) + self.assertEqual(mock_execute.call_args[-1]['timeout'], NOT_SET) def test_float_timeout(self): - with mock.patch.object(Session, 'execute', autospec=True) as mock_execute: + with mock.patch.object(Session, 'execute') as mock_execute: list(TestModel.objects().timeout(0.5)) - mock_execute.assert_called_once_with(mock.ANY, mock.ANY, mock.ANY, timeout=0.5) + self.assertEqual(mock_execute.call_args[-1]['timeout'], 0.5) def test_none_timeout(self): - with mock.patch.object(Session, 'execute', autospec=True) as mock_execute: + with mock.patch.object(Session, 'execute') as mock_execute: list(TestModel.objects().timeout(None)) - mock_execute.assert_called_once_with(mock.ANY, mock.ANY, mock.ANY, timeout=None) + self.assertEqual(mock_execute.call_args[-1]['timeout'], None) class DMLQueryTimeoutTestCase(BaseQuerySetUsage): @@ -733,19 +733,19 @@ class DMLQueryTimeoutTestCase(BaseQuerySetUsage): super(DMLQueryTimeoutTestCase, self).setUp() def test_default_timeout(self): - with mock.patch.object(Session, 'execute', autospec=True) as mock_execute: + with mock.patch.object(Session, 'execute') as mock_execute: self.model.save() - mock_execute.assert_called_once_with(mock.ANY, mock.ANY, mock.ANY, timeout=NOT_SET) + self.assertEqual(mock_execute.call_args[-1]['timeout'], NOT_SET) def test_float_timeout(self): - with mock.patch.object(Session, 'execute', autospec=True) as mock_execute: + with mock.patch.object(Session, 'execute') as mock_execute: self.model.timeout(0.5).save() - mock_execute.assert_called_once_with(mock.ANY, mock.ANY, mock.ANY, timeout=0.5) + self.assertEqual(mock_execute.call_args[-1]['timeout'], 0.5) def test_none_timeout(self): - with mock.patch.object(Session, 'execute', autospec=True) as mock_execute: + with mock.patch.object(Session, 'execute') as mock_execute: self.model.timeout(None).save() - mock_execute.assert_called_once_with(mock.ANY, mock.ANY, mock.ANY, timeout=None) + self.assertEqual(mock_execute.call_args[-1]['timeout'], None) def test_timeout_then_batch(self): b = query.BatchQuery()