Skip to content

Commit

Permalink
Feat: Sort Projects Alphabetically
Browse files Browse the repository at this point in the history
  • Loading branch information
reglim committed Apr 30, 2024
1 parent 377a09e commit c2041e3
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
2 changes: 1 addition & 1 deletion docat/docat/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ def get_all_projects(upload_folder_path: Path, include_hidden: bool) -> Projects
"""
projects: list[Project] = []

for project in upload_folder_path.iterdir():
for project in sorted(upload_folder_path.iterdir()):
if not project.is_dir():
continue

Expand Down
11 changes: 9 additions & 2 deletions docat/tests/test_project.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,22 @@


def test_project_api(temp_project_version):
project = "project"
docs = temp_project_version(project, "1.0")
docs = temp_project_version("project", "1.0")
docs = temp_project_version("different-project", "1.0")

with patch("docat.app.DOCAT_UPLOAD_FOLDER", docs):
response = client.get("/api/projects")

assert response.status_code == httpx.codes.OK
assert response.json() == {
"projects": [
{
"name": "different-project",
"logo": False,
"versions": [
{"name": "1.0", "tags": ["latest"], "hidden": False},
],
},
{
"name": "project",
"logo": False,
Expand Down

0 comments on commit c2041e3

Please sign in to comment.