Skip to content

Commit

Permalink
More consistent use of service file for test db connection
Browse files Browse the repository at this point in the history
  • Loading branch information
strk committed Nov 14, 2019
1 parent 46a0572 commit dea253b
Show file tree
Hide file tree
Showing 8 changed files with 10 additions and 10 deletions.
2 changes: 1 addition & 1 deletion tests/src/core/testqgsvectorlayerjoinbuffer.cpp
Expand Up @@ -116,7 +116,7 @@ void TestVectorLayerJoinBuffer::initTestCase()
QString dbConn = getenv( "QGIS_PGTEST_DB" );
if ( dbConn.isEmpty() )
{
dbConn = "dbname='qgis_test'";
dbConn = "service=qgis_test";
}
QgsVectorLayer *vlA_PG = new QgsVectorLayer( QString( "%1 sslmode=disable key='id_a' table=\"qgis_test\".\"table_a\" sql=" ).arg( dbConn ), "A_PG", "postgres" );
QgsVectorLayer *vlB_PG = new QgsVectorLayer( QString( "%1 sslmode=disable key='id_b' table=\"qgis_test\".\"table_b\" sql=" ).arg( dbConn ), "B_PG", "postgres" );
Expand Down
2 changes: 1 addition & 1 deletion tests/src/python/test_db_manager_postgis.py
Expand Up @@ -171,7 +171,7 @@ def setUpServer(cls):

@classmethod
def setUpProvider(cls, authId):
cls.dbconn = 'dbname=\'qgis_test\''
cls.dbconn = 'service=qgis_test'
if 'QGIS_PGTEST_DB' in os.environ:
cls.dbconn = os.environ['QGIS_PGTEST_DB']
uri = QgsDataSourceUri()
Expand Down
2 changes: 1 addition & 1 deletion tests/src/python/test_processing_importintopostgis.py
Expand Up @@ -88,7 +88,7 @@ def test_import(self):
# Check that data have been imported correctly
exported = QgsVectorLayer(unitTestDataPath() + '/points.shp', 'exported')
self.assertTrue(exported.isValid())
imported = QgsVectorLayer("service='qgis_test' dbname=\'qgis_test\' table=\"CamelCaseSchema\".\"%s\" (geom)" % table_name, 'imported', 'postgres')
imported = QgsVectorLayer("service='qgis_test' table=\"CamelCaseSchema\".\"%s\" (geom)" % table_name, 'imported', 'postgres')
self.assertTrue(imported.isValid())
imported_fields = [f.name() for f in imported.fields()]
for f in exported.fields():
Expand Down
2 changes: 1 addition & 1 deletion tests/src/python/test_project_storage_postgres.py
Expand Up @@ -70,7 +70,7 @@ class TestPyQgsProjectStoragePostgres(unittest.TestCase):
@classmethod
def setUpClass(cls):
"""Run before all tests"""
cls.dbconn = 'dbname=\'qgis_test\''
cls.dbconn = 'service=qgis_test'
if 'QGIS_PGTEST_DB' in os.environ:
cls.dbconn = os.environ['QGIS_PGTEST_DB']
cls.ds_uri = QgsDataSourceUri(cls.dbconn)
Expand Down
6 changes: 3 additions & 3 deletions tests/src/python/test_provider_postgres.py
Expand Up @@ -61,7 +61,7 @@ class TestPyQgsPostgresProvider(unittest.TestCase, ProviderTestCase):
@classmethod
def setUpClass(cls):
"""Run before all tests"""
cls.dbconn = 'dbname=\'qgis_test\''
cls.dbconn = 'service=qgis_test'
if 'QGIS_PGTEST_DB' in os.environ:
cls.dbconn = os.environ['QGIS_PGTEST_DB']
# Create test layers
Expand Down Expand Up @@ -1379,7 +1379,7 @@ def testMassivePaste(self):
def testFilterOnCustomBbox(self):
extent = QgsRectangle(-68, 70, -67, 80)
request = QgsFeatureRequest().setFilterRect(extent)
dbconn = 'dbname=\'qgis_test\''
dbconn = 'service=qgis_test'
uri = '%s srid=4326 key="pk" sslmode=disable table="qgis_test"."some_poly_data_shift_bbox" (geom)' % (dbconn)

def _test(vl, ids):
Expand Down Expand Up @@ -1421,7 +1421,7 @@ class TestPyQgsPostgresProviderCompoundKey(unittest.TestCase, ProviderTestCase):
@classmethod
def setUpClass(cls):
"""Run before all tests"""
cls.dbconn = 'dbname=\'qgis_test\''
cls.dbconn = 'service=qgis_test'
if 'QGIS_PGTEST_DB' in os.environ:
cls.dbconn = os.environ['QGIS_PGTEST_DB']
# Create test layers
Expand Down
2 changes: 1 addition & 1 deletion tests/src/python/test_qgspostgrestransaction.py
Expand Up @@ -34,7 +34,7 @@ def setUpClass(cls):
Setup the involved layers and relations for a n:m relation
:return:
"""
cls.dbconn = 'dbname=\'qgis_test\''
cls.dbconn = 'service=qgis_test'
if 'QGIS_PGTEST_DB' in os.environ:
cls.dbconn = os.environ['QGIS_PGTEST_DB']
# Create test layer
Expand Down
2 changes: 1 addition & 1 deletion tests/src/python/test_qgsvectorfilewriter.py
Expand Up @@ -120,7 +120,7 @@ def testWriteWithLongLongField(self):
def testWriteWithBoolField(self):

# init connection string
dbconn = 'dbname=\'qgis_test\''
dbconn = 'service=qgis_test'
if 'QGIS_PGTEST_DB' in os.environ:
dbconn = os.environ['QGIS_PGTEST_DB']

Expand Down
2 changes: 1 addition & 1 deletion tests/src/python/test_qgsvectorlayerutils.py
Expand Up @@ -307,7 +307,7 @@ def testCreateFeature(self):
"addfeat", "memory")

# init connection string
dbconn = 'dbname=\'qgis_test\''
dbconn = 'service=qgis_test'
if 'QGIS_PGTEST_DB' in os.environ:
dbconn = os.environ['QGIS_PGTEST_DB']

Expand Down

0 comments on commit dea253b

Please sign in to comment.