Skip to content

Commit

Permalink
Add a raster table to the test postgis setup, use it from dbmanager test
Browse files Browse the repository at this point in the history
  • Loading branch information
strk committed Jun 6, 2017
1 parent 3738798 commit 7af47c2
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 2 deletions.
4 changes: 2 additions & 2 deletions python/plugins/db_manager/db_plugins/postgis/plugin_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,8 @@ class TestDBManagerPostgisPlugin(unittest.TestCase):

def test_rasterTable(self):

#testdb = os.environ.get('QGIS_PGTEST_DB') or 'qgis_test'
#os.environ['PGDATABASE'] = testdb
testdb = os.environ.get('QGIS_PGTEST_DB') or 'qgis_test'
os.environ['PGDATABASE'] = testdb

obj = QObject() # needs to be kept alive
database = PGDatabase(obj, QgsDataSourceUri())
Expand Down
1 change: 1 addition & 0 deletions tests/testdata/provider/testdata_pg.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ SCRIPTS="
tests/testdata/provider/testdata_pg_vectorjoin.sql
tests/testdata/provider/testdata_pg_hstore.sql
tests/testdata/provider/testdata_pg_array.sql
tests/testdata/provider/testdata_pg_raster.sql
"

dropdb qgis_test 2> /dev/null || true
Expand Down
15 changes: 15 additions & 0 deletions tests/testdata/provider/testdata_pg_raster.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
-- Table: qgis_test.raster1

CREATE TABLE qgis_test."Raster1"
(
pk serial NOT NULL,
name character varying(255),
"Rast" raster
);

INSERT INTO qgis_test."Raster1" (name, "Rast") SELECT
'simple one',
ST_AddBand(
ST_MakeEmptyRaster(16, 32, 7, -5, 0.2, -0.7, 0, 0, 0),
1, '8BUI', 0.0, NULL
);

0 comments on commit 7af47c2

Please sign in to comment.