Skip to content
Permalink
Browse files

unit test for 2826ba3

  • Loading branch information
jef-n committed Apr 7, 2019
1 parent 4a87cc9 commit f8e32f7b9e21c2bdee6c80e796f8d448fef19e12
@@ -155,7 +155,6 @@ ADD_PYTHON_TEST(PyQgsPanelWidgetStack test_qgspanelwidgetstack.py)
ADD_PYTHON_TEST(PyQgsPoint test_qgspoint.py)
ADD_PYTHON_TEST(PyQgsPointClusterRenderer test_qgspointclusterrenderer.py)
ADD_PYTHON_TEST(PyQgsPointDisplacementRenderer test_qgspointdisplacementrenderer.py)
ADD_PYTHON_TEST(PyQgsPostgresDomain test_qgspostgresdomain.py)
ADD_PYTHON_TEST(PyQgsProcessingRecentAlgorithmLog test_qgsprocessingrecentalgorithmslog.py)
ADD_PYTHON_TEST(PyQgsProcessingInPlace test_qgsprocessinginplace.py)
ADD_PYTHON_TEST(PyQgsProcessingAlgRunner test_qgsprocessingalgrunner.py)
@@ -262,6 +261,7 @@ ENDIF (WITH_DESKTOP)

IF (ENABLE_PGTEST)
ADD_PYTHON_TEST(PyQgsPostgresProvider test_provider_postgres.py)
ADD_PYTHON_TEST(PyQgsPostgresDomain test_qgspostgresdomain.py)
ADD_PYTHON_TEST(PyQgsPostgresTransaction test_qgspostgrestransaction.py)
ADD_PYTHON_TEST(PyQgsRelationEditWidget test_qgsrelationeditwidget.py)
ADD_PYTHON_TEST(PyQgsVectorLayerTools test_qgsvectorlayertools.py)
@@ -441,7 +441,7 @@ def testTransactionDirty(self):
ft1 = vl.getFeatures('pk=1')
self.assertFalse(ft1.nextFeature(f))

def testTransactionConstrains(self):
def testTransactionConstraints(self):
# create a vector layer based on postgres
vl = QgsVectorLayer(self.dbconn + ' sslmode=disable key=\'id\' table="qgis_test"."check_constraints" sql=', 'test', 'postgres')
self.assertTrue(vl.isValid())
@@ -626,7 +626,7 @@ def testJson(self):
fi = vl.getFeatures(QgsFeatureRequest())
f = QgsFeature()

#test list
# test list
fi.nextFeature(f)
value_idx = vl.fields().lookupField('jvalue')
self.assertIsInstance(f.attributes()[value_idx], list)
@@ -638,7 +638,7 @@ def testJson(self):
self.assertEqual(f.attributes()[value_idx], [4, 5, 6])
self.assertEqual(f.attributes()[value_idx], [4.0, 5.0, 6.0])

#test dict
# test dict
fi.nextFeature(f)
value_idx = vl.fields().lookupField('jvalue')
self.assertIsInstance(f.attributes()[value_idx], dict)
@@ -1248,6 +1248,12 @@ def uncompiledFilters(self):
def partiallyCompiledFilters(self):
return set([])

def testConstraints(self):
for key in ["key1", "key2"]:
idx = self.vl.dataProvider().fieldNameIndex(key)
self.assertTrue(idx >= 0)
self.assertFalse(self.vl.dataProvider().fieldConstraints(idx) & QgsFieldConstraints.ConstraintUnique)


if __name__ == '__main__':
unittest.main()
@@ -2,7 +2,7 @@

set -e

echo "SET client_min_messages TO WARNING;" >> ~/.psqlrc
DB=${DB:-qgis_test}

SCRIPTS="
tests/testdata/provider/testdata_pg.sql
@@ -15,8 +15,8 @@ SCRIPTS="
tests/testdata/provider/testdata_pg_json.sql
"

dropdb qgis_test 2> /dev/null || true
createdb qgis_test -E UTF8 -T template0 || exit 1
dropdb --if-exists $DB
createdb $DB -E UTF8 -T template0
for f in ${SCRIPTS}; do
psql -q --echo-errors -f $f qgis_test -v ON_ERROR_STOP=1
psql -q --echo-errors -c "SET client_min_messages TO WARNING;" -f $f $DB -v ON_ERROR_STOP=1
done
@@ -23,7 +23,9 @@ CREATE EXTENSION IF NOT EXISTS postgis;

DROP SCHEMA IF EXISTS qgis_test CASCADE;
CREATE SCHEMA qgis_test;

GRANT ALL ON SCHEMA qgis_test TO public;
ALTER DEFAULT PRIVILEGES IN SCHEMA qgis_test GRANT ALL ON TABLES TO public;
ALTER DEFAULT PRIVILEGES IN SCHEMA qgis_test GRANT ALL ON SEQUENCES TO public;

SET default_tablespace = '';

@@ -467,6 +469,8 @@ INSERT INTO qgis_test.rename_table (field1,field2) VALUES ('a','b');
-- Table for editor widget types
--

DROP TABLE IF EXISTS qgis_editor_widget_styles;

CREATE TABLE qgis_editor_widget_styles
(
schema_name TEXT NOT NULL,

0 comments on commit f8e32f7

Please sign in to comment.
You can’t perform that action at this time.