File: test_spatialite.py

package info (click to toggle)
datasette 0.65.2%2Bds-1
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 3,540 kB
  • sloc: python: 19,371; javascript: 10,089; sh: 71; makefile: 47; ansic: 26
file content (23 lines) | stat: -rw-r--r-- 803 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
from datasette.app import Datasette
from datasette.utils import find_spatialite, SpatialiteNotFound, SPATIALITE_FUNCTIONS
from .utils import has_load_extension
import pytest


def has_spatialite():
    try:
        find_spatialite()
        return True
    except SpatialiteNotFound:
        return False


@pytest.mark.asyncio
@pytest.mark.skipif(not has_spatialite(), reason="Requires SpatiaLite")
@pytest.mark.skipif(not has_load_extension(), reason="Requires enable_load_extension")
async def test_spatialite_version_info():
    ds = Datasette(sqlite_extensions=["spatialite"])
    response = await ds.client.get("/-/versions.json")
    assert response.status_code == 200
    spatialite = response.json()["sqlite"]["extensions"]["spatialite"]
    assert set(SPATIALITE_FUNCTIONS) == set(spatialite)