def test_insert_with_OperationFailure(self, mock_MongoClient):
     mock_MongoClient.site_effect = errors.OperationFailure
     create_db_instance("localhost2", 27017, "memo", "memo", "memo")
     self.assertEqual(mock_MongoClient.assert_called_once(), None)
 def test_incorrect_host(self, mock_MongoClient):
     db = create_db_instance("localhost2", 27017, "memo", "memo", "memo")
     db["memo"].list_collection_names()
     with self.assertRaises(AssertionError):
         mock_MongoClient.assert_called_with(self.correct_connection)
 def test_insert_with_ServerSelectionTimeoutError(self, mock_MongoClient):
     mock_MongoClient.site_effect = errors.ServerSelectionTimeoutError
     create_db_instance("localhost2", 27017, "memo", "memo", "memo")
     self.assertEqual(mock_MongoClient.assert_called_once(), None)
 def test_correct_connection(self, mock_MongoClient):
     db = create_db_instance("localhost", 27017, "memo", "memo", "memo")
     db["memo"].list_collection_names()
     mock_MongoClient.assert_called_with(self.correct_connection)