Spatiallite3 provider implementation (#17)
* new file: docker/Dockerfile Dockerfile for pygeoapi * modified: pygeoapi/provider/__init__.py new file: tests/data/ne_110m_lakes.sqlite new file: tests/json_marshmallow.py new file: tests/test_sqlite_provider.py Sqlit implementation and testing marshmallows * new file: provider/sqlite.py new file: provider/tmp_parser.py Sqlite provider * Testing sqlalchemy * query for sqlite3 * Countries dataset, message in assert * yml config * table in data link and query implemented without limit * PR of refactor * functional sqlite3 driver * flake8 * pipreq for complete list of requirements * updated readme with working examples, extra requirements * typos, SQLite removed Dockerfile and ne_100m_lakes.sqlite * update requirements * pypandoc in requirements-dev.txt
This commit is contained in:
committed by
Tom Kralidis
parent
557a9e3480
commit
1de0439e2d
@@ -0,0 +1,37 @@
|
||||
# Needs to be run like: pytest -s test_sqlite_provider.py
|
||||
# In eclipse we need to set PYGEOAPI_CONFIG, Run>Debug Configurations>
|
||||
# (Arguments as py.test and set external variables to the correct config path)
|
||||
|
||||
import pytest
|
||||
from pygeoapi.provider.sqlite import SQLiteProvider
|
||||
|
||||
|
||||
@pytest.fixture()
|
||||
def config():
|
||||
return {
|
||||
'name': 'Sqlite',
|
||||
'data': './tests/data/ne_110m_admin_0_countries.sqlite',
|
||||
'id_field': "ogc_fid",
|
||||
'table': 'ne_110m_admin_0_countries'}
|
||||
|
||||
|
||||
def test_query(config):
|
||||
"""Testing query for a valid JSON object with geometry"""
|
||||
|
||||
p = SQLiteProvider(config)
|
||||
feature_collection = p.query()
|
||||
assert feature_collection.get('type', None) == "FeatureCollection"
|
||||
features = feature_collection.get('features', None)
|
||||
assert features is not None
|
||||
feature = features[0]
|
||||
properties = feature.get("properties", None)
|
||||
assert properties is not None
|
||||
geometry = feature.get("geometry", None)
|
||||
assert geometry is not None
|
||||
|
||||
|
||||
def test_get(config):
|
||||
p = SQLiteProvider(config)
|
||||
results = p.get(118)
|
||||
assert len(results['features']) == 1
|
||||
assert "Netherlands" in results['features'][0]['properties']['admin']
|
||||
Reference in New Issue
Block a user