def test_multishard_create_index_no_untargetted_query_callback_called( self): _callback = Mock() api.set_untargetted_query_callback(_callback) operations.multishard_create_index('dummy', [('x', ASCENDING)]) _callback.assert_not_called()
def test_untargetted_query_callback(self): _callback = Mock() doc1 = {'x': 1, 'y': 1} doc2 = {'x': 2, 'y': 1} self.db1.dummy.insert(doc1) self.db2.dummy.insert(doc2) api.set_untargetted_query_callback(_callback) list(operations.multishard_find('dummy', {'y': 1})) _callback.assert_called_with('dummy', {'y': 1})