if self.connector.table_exists(params[0]):
results = [{'1': '1'}]
elif sql == "select sql from sqlite_master where name = :n and type=:t":
- results = [{'sql': self.connector.table_definition(params['t'], params['n'])}]
+ if self.connector.table_exists(params['n']):
+ results = [{'sql': self.connector.table_definition(params['t'], params['n'])}]
elif sql == "select sql from sqlite_master where tbl_name = :n and type='index' and sql is not null":
results = [{'sql': sql} for sql in self.connector.indices_definition(params['n'])]
else:
def test_table_not_exists_json(app_client):
assert {
'ok': False,
- 'title': 'Invalid SQL',
- 'error': 'no such table: blah',
- 'status': 400,
+ 'error': 'Table not found: blah',
+ 'status': 404,
+ 'title': None,
} == app_client.get('/dummy_tables/blah.json').json
def test_table_shape_arrays(app_client):