コード例 #1
0
 def test_singleton(self):
     """Test that MongoDB class is a singleton."""
     orion_db = MongoDB(username='******', password='******', name='orion_test')
     # reinit connection does not change anything
     orion_db.initiate_connection()
     orion_db.close_connection()
     assert MongoDB() is orion_db
コード例 #2
0
 def test_singleton(self):
     """Test that MongoDB class is a singleton."""
     orion_db = MongoDB(
         "mongodb://localhost",
         port=27017,
         name="orion_test",
         username="******",
         password="******",
     )
     # reinit connection does not change anything
     orion_db.initiate_connection()
     orion_db.close_connection()
     assert MongoDB() is orion_db