| 1 |
from datasette.app import Datasette |
| 2 |
from datasette.utils import find_spatialite, SpatialiteNotFound, SPATIALITE_FUNCTIONS |
| 3 |
from .utils import has_load_extension |
| 4 |
import pytest |
| 5 |
|
| 6 |
|
| 7 |
def has_spatialite(): |
| 8 |
try: |
| 9 |
find_spatialite() |
| 10 |
return True |
| 11 |
except SpatialiteNotFound: |
| 12 |
return False |
| 13 |
|
| 14 |
|
| 15 |
@pytest.mark.asyncio |
| 16 |
@pytest.mark.skipif(not has_spatialite(), reason="Requires SpatiaLite") |
| 17 |
@pytest.mark.skipif(not has_load_extension(), reason="Requires enable_load_extension") |
| 18 |
async def test_spatialite_version_info(): |
| 19 |
ds = Datasette(sqlite_extensions=["spatialite"]) |
| 20 |
response = await ds.client.get("/-/versions.json") |
| 21 |
assert response.status_code == 200 |
| 22 |
spatialite = response.json()["sqlite"]["extensions"]["spatialite"] |
| 23 |
assert set(SPATIALITE_FUNCTIONS) == set(spatialite) |