mirror of
https://github.com/simonw/datasette.git
synced 2025-12-10 16:51:24 +01:00
parent
f4794df070
commit
ff2ab9dc7d
4 changed files with 43 additions and 27 deletions
|
|
@ -91,6 +91,21 @@ def test_table_page(three_table_app_client):
|
|||
}]
|
||||
|
||||
|
||||
def test_view(three_table_app_client):
|
||||
_, response = three_table_app_client.get('/four_tables/simple_view')
|
||||
assert response.status == 200
|
||||
_, response = three_table_app_client.get('/four_tables/simple_view.jsono')
|
||||
assert response.status == 200
|
||||
data = response.json
|
||||
assert data['rows'] == [{
|
||||
'upper_content': 'HELLO',
|
||||
'content': 'hello',
|
||||
}, {
|
||||
'upper_content': 'WORLD',
|
||||
'content': 'world',
|
||||
}]
|
||||
|
||||
|
||||
FOUR_TABLES = '''
|
||||
CREATE TABLE simple_primary_key (
|
||||
pk varchar(30) primary key,
|
||||
|
|
@ -115,4 +130,7 @@ CREATE TABLE "Table With Space In Name" (
|
|||
|
||||
INSERT INTO simple_primary_key VALUES (1, 'hello');
|
||||
INSERT INTO simple_primary_key VALUES (2, 'world');
|
||||
|
||||
CREATE VIEW simple_view AS
|
||||
SELECT content, upper(content) AS upper_content FROM simple_primary_key;
|
||||
'''
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue