From bebf2dd8e68c9d857ba22e2eaf6977b6ca1a8a57 Mon Sep 17 00:00:00 2001 From: Javier Sancho Date: Wed, 14 Oct 2020 10:46:01 +0200 Subject: [PATCH] database page --- datasette_pytables/__init__.py | 3 +++ tests/test_api.py | 22 +++++++++++----------- 2 files changed, 14 insertions(+), 11 deletions(-) diff --git a/datasette_pytables/__init__.py b/datasette_pytables/__init__.py index 396cd0d..a56bc3d 100644 --- a/datasette_pytables/__init__.py +++ b/datasette_pytables/__init__.py @@ -53,6 +53,9 @@ class PyTablesConnector(dc.Connector): def detect_fts(self, table_name): return False + def foreign_keys(self, table_name): + return [] + def inspect(path): "Open file and return tables info" diff --git a/tests/test_api.py b/tests/test_api.py index 9d50932..a6c7809 100644 --- a/tests/test_api.py +++ b/tests/test_api.py @@ -11,7 +11,7 @@ def test_homepage(app_client): assert d['tables_count'] == 5 def test_database_page(app_client): - response = app_client.get('/test_tables.json', gather_request=False) + response = app_client.get('/test_tables.json') data = response.json assert 'test_tables' == data['database'] assert [{ @@ -19,46 +19,46 @@ def test_database_page(app_client): 'columns': ['value'], 'primary_keys': [], 'count': 2, - 'label_column': None, 'hidden': False, 'fts_table': None, - 'foreign_keys': {'incoming': [], 'outgoing': []} + 'foreign_keys': {'incoming': [], 'outgoing': []}, + 'private': False, }, { 'name': '/group1/array2', 'columns': ['value'], 'primary_keys': [], 'count': 10000, - 'label_column': None, 'hidden': False, 'fts_table': None, - 'foreign_keys': {'incoming': [], 'outgoing': []} + 'foreign_keys': {'incoming': [], 'outgoing': []}, + 'private': False, }, { 'name': '/group1/table1', 'columns': ['identity', 'idnumber', 'speed'], 'primary_keys': [], 'count': 10000, - 'label_column': None, 'hidden': False, 'fts_table': None, - 'foreign_keys': {'incoming': [], 'outgoing': []} + 'foreign_keys': {'incoming': [], 'outgoing': []}, + 'private': False, }, { 'name': '/group2/multi', 'columns': ['value'], 'primary_keys': [], 'count': 10, - 'label_column': None, 'hidden': False, 'fts_table': None, - 'foreign_keys': {'incoming': [], 'outgoing': []} + 'foreign_keys': {'incoming': [], 'outgoing': []}, + 'private': False, }, { 'name': '/group2/table2', 'columns': ['identity', 'idnumber', 'speed'], 'primary_keys': [], 'count': 10000, - 'label_column': None, 'hidden': False, 'fts_table': None, - 'foreign_keys': {'incoming': [], 'outgoing': []} + 'foreign_keys': {'incoming': [], 'outgoing': []}, + 'private': False, }] == data['tables'] def test_custom_sql(app_client): -- 2.39.5