-
Notifications
You must be signed in to change notification settings - Fork 20
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add in a functional test for the http server as well
- Loading branch information
Showing
4 changed files
with
38 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
import pytest | ||
|
||
import duckdb | ||
from fastapi import FastAPI | ||
from fastapi.testclient import TestClient | ||
|
||
from buenavista.backends.duckdb import DuckDBConnection | ||
from buenavista.examples.duckdb_http import rewriter | ||
from buenavista.http import main | ||
|
||
|
||
@pytest.fixture(scope="session") | ||
def db(): | ||
return duckdb.connect() | ||
|
||
|
||
@pytest.fixture(scope="session") | ||
def client(db): | ||
app = FastAPI() | ||
main.quacko(app, DuckDBConnection(db), rewriter) | ||
return TestClient(app) | ||
|
||
|
||
def test_info(client): | ||
response = client.get("/v1/info") | ||
assert response.status_code == 200 | ||
|
||
|
||
def test_select(client): | ||
response = client.post( | ||
"/v1/statement", | ||
json="SELECT 1", | ||
headers={"Content-Type": "application/json", "x-trino-user": "test"}, | ||
) | ||
assert response.status_code == 200 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters