Exemplo n.º 1
0
 def test_exceptions1(self):
     mongo_connection = MongoProxy(
         MongoConnection(exceptions_to_raise=[ValueError]), methods_needing_retry={MongoConnection: ['find', ]}
     )
     with self.assertRaises(ValueError):
         mongo_connection.find()
     self.assertEqual(mongo_connection.call_count, 1)
Exemplo n.º 2
0
 def test_exceptions1(self):
     mongo_connection = MongoProxy(
         MongoConnection(exceptions_to_raise=[ValueError]),
         methods_needing_retry={MongoConnection: [
             'find',
         ]})
     with self.assertRaises(ValueError):
         mongo_connection.find()
     self.assertEqual(mongo_connection.call_count, 1)
Exemplo n.º 3
0
 def test_exceptions2(self):
     mongo_connection = MongoProxy(
         MongoConnection(exceptions_to_raise=[AutoReconnect, AutoReconnect]),
         methods_needing_retry={MongoConnection: ['find', ]}
     )
     self.assertEqual(mongo_connection.find(), "Finished.")
     self.assertEqual(mongo_connection.call_count, 3)
Exemplo n.º 4
0
 def test_no_exceptions1(self):
     mongo_connection = MongoProxy(
         MongoConnection(),
         methods_needing_retry={MongoConnection: [
             'find',
         ]})
     self.assertEqual(mongo_connection.find(), "Finished.")
     self.assertEqual(mongo_connection.call_count, 1)
Exemplo n.º 5
0
 def test_exceptions2(self):
     mongo_connection = MongoProxy(
         MongoConnection(
             exceptions_to_raise=[AutoReconnect, AutoReconnect]),
         methods_needing_retry={MongoConnection: [
             'find',
         ]})
     self.assertEqual(mongo_connection.find(), "Finished.")
     self.assertEqual(mongo_connection.call_count, 3)
Exemplo n.º 6
0
 def test_no_exceptions1(self):
     mongo_connection = MongoProxy(MongoConnection(), methods_needing_retry={MongoConnection: ['find', ]})
     self.assertEqual(mongo_connection.find(), "Finished.")
     self.assertEqual(mongo_connection.call_count, 1)