def test_can_run_mongo(self): box = MongoBox() box.start() db_path = box.db_path self.assertTrue(box.running()) self.assertIsNotNone(box.port) client = box.client() self.assertTrue(client.alive()) box.stop() self.assertFalse(box.running()) self.assertFalse(client.alive()) self.assertFalse(os.path.exists(db_path))
def test_can_run_mongo(self): box = MongoBox() box.start() db_path = box.db_path self.assertTrue(box.running()) self.assertIsNotNone(box.port) client = box.client() try: client.list_databases() except: self.fail('Cannot list databases') box.stop() self.assertFalse(box.running()) self.assertFalse(os.path.exists(db_path)) with self.assertRaises(AutoReconnect): client.list_databases()