-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
85 additions
and
7 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
[run] | ||
omit = duetector/cli/* |
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
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,40 @@ | ||
import pytest | ||
from fastapi.testclient import TestClient | ||
|
||
from duetector.analyzer.db import DBAnalyzer | ||
from duetector.service.app import app | ||
from duetector.service.config import get_config | ||
|
||
|
||
@pytest.fixture | ||
def configed_app(full_config): | ||
app.dependency_overrides = {get_config: lambda: full_config} | ||
return app | ||
|
||
|
||
@pytest.fixture | ||
def client(configed_app): | ||
with TestClient(configed_app) as client: | ||
yield client | ||
|
||
|
||
def test_query(client: TestClient): | ||
response = client.get(f"/query/") | ||
assert response.status_code == 200 | ||
assert response.json() == {"analyzers": [DBAnalyzer.config_scope]} | ||
|
||
|
||
def test_query_brief(client: TestClient): | ||
response = client.get(f"/query/{DBAnalyzer.config_scope}/brief") | ||
assert response.status_code == 200 | ||
assert response.json() | ||
|
||
|
||
def test_query_analyzer(client: TestClient): | ||
response = client.post(f"/query/{DBAnalyzer.config_scope}") | ||
assert response.status_code == 200 | ||
assert response.json() | ||
|
||
|
||
if __name__ == "__main__": | ||
pytest.main(["-vv", "-s", __file__]) |
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 was deleted.
Oops, something went wrong.