Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
This change massively improves the usability while doing local development. It also fixes #40. The local development now also proxies the `/api` and `/doc` endpoints from the backend (port 5000) through the frontend (port 8080) making CORS handling simpler during development.
- Loading branch information
1 parent
ff9e61c
commit cb4b9c6
Showing
17 changed files
with
189 additions
and
124 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
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 |
---|---|---|
|
@@ -15,8 +15,6 @@ server { | |
|
||
location /doc { | ||
root /var/docat; | ||
autoindex on; | ||
autoindex_format json; | ||
} | ||
|
||
location /api { | ||
|
This file was deleted.
Oops, something went wrong.
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,45 @@ | ||
from unittest.mock import patch | ||
|
||
from fastapi.testclient import TestClient | ||
|
||
from docat.app import app | ||
|
||
client = TestClient(app) | ||
|
||
|
||
def test_project_api(temp_project_version): | ||
project = "project" | ||
docs = temp_project_version(project, "1.0") | ||
|
||
with patch("docat.app.DOCAT_UPLOAD_FOLDER", docs): | ||
response = client.get("/api/projects") | ||
|
||
assert response.ok | ||
assert response.json() == {"projects": ["project"]} | ||
|
||
|
||
def test_project_api_without_any_projects(): | ||
response = client.get("/api/projects") | ||
|
||
assert response.ok | ||
assert response.json() == {"projects": []} | ||
|
||
|
||
def test_project_details_api(temp_project_version): | ||
project = "project" | ||
docs = temp_project_version(project, "1.0") | ||
symlink_to_latest = docs / project / "latest" | ||
assert symlink_to_latest.is_symlink() | ||
|
||
with patch("docat.app.DOCAT_UPLOAD_FOLDER", docs): | ||
response = client.get(f"/api/projects/{project}") | ||
|
||
assert response.ok | ||
assert response.json() == {"name": "project", "versions": [{"name": "1.0", "tags": ["latest"]}]} | ||
|
||
|
||
def test_project_details_api_with_a_project_that_does_not_exist(): | ||
response = client.get("/api/projects/i-do-not-exist") | ||
|
||
assert not response.ok | ||
assert response.json() == {"message": "Project i-do-not-exist does not exist"} |
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
Oops, something went wrong.