本文整理匯總了Python中db_manager.db_plugins.postgis.connector.PostGisDBConnector.uri方法的典型用法代碼示例。如果您正苦於以下問題:Python PostGisDBConnector.uri方法的具體用法?Python PostGisDBConnector.uri怎麽用?Python PostGisDBConnector.uri使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類db_manager.db_plugins.postgis.connector.PostGisDBConnector
的用法示例。
在下文中一共展示了PostGisDBConnector.uri方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: test_dbnameLessURI
# 需要導入模塊: from db_manager.db_plugins.postgis.connector import PostGisDBConnector [as 別名]
# 或者: from db_manager.db_plugins.postgis.connector.PostGisDBConnector import uri [as 別名]
def test_dbnameLessURI(self):
c = PostGisDBConnector(QgsDataSourceUri())
self.assertIsInstance(c, PostGisDBConnector)
uri = c.uri()
# No username was passed, so we expect it to be taken
# from PGUSER or USER environment variables
expected_user = os.environ.get('PGUSER') or os.environ.get('USER')
actual_user = self._getUser(c)
self.assertEqual(actual_user, expected_user)
# No database was passed, so we expect it to be taken
# from PGDATABASE or expected user
expected_db = os.environ.get('PGDATABASE') or expected_user
actual_db = self._getDatabase(c)
self.assertEqual(actual_db, expected_db)