Skip to content

Commit

Permalink
Fix API endpoint for topics (#1128)
Browse files Browse the repository at this point in the history
  • Loading branch information
allenporter authored Oct 20, 2024
1 parent 0449050 commit a083815
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion google_nest_sdm/admin_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ async def list_topics(self, projects_prefix: str) -> list[str]:
The topic prefix should be in the format `projects/{console_project_id}`.
"""
validate_projects_prefix(projects_prefix)
response = await self._auth.get_json(projects_prefix)
response = await self._auth.get_json(f"{projects_prefix}/topics")
return [topic["name"] for topic in response["topics"]]

async def get_topic(self, topic_name: str) -> dict[str, Any]:
Expand Down
6 changes: 3 additions & 3 deletions tests/test_admin_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ async def test_list_topics(
}
],
)
app.router.add_get(f"/projects/{GOOGLE_CLOUD_CONSOLE_PROJECT_ID}", handler)
app.router.add_get(f"/projects/{GOOGLE_CLOUD_CONSOLE_PROJECT_ID}/topics", handler)

client = await admin_client()
topics = await client.list_topics(f"projects/{GOOGLE_CLOUD_CONSOLE_PROJECT_ID}")
Expand Down Expand Up @@ -342,7 +342,7 @@ async def test_list_eligible_topics(
}
],
)
app.router.add_get(f"/projects/{GOOGLE_CLOUD_CONSOLE_PROJECT_ID}", cloud_handler)
app.router.add_get(f"/projects/{GOOGLE_CLOUD_CONSOLE_PROJECT_ID}/topics", cloud_handler)

client = await admin_client()
eligible_topics = await client.list_eligible_topics(DEVICE_ACCESS_PROJECT_ID)
Expand Down Expand Up @@ -390,7 +390,7 @@ async def test_list_eligible_topics_no_sdm_topic(
}
],
)
app.router.add_get(f"/projects/{GOOGLE_CLOUD_CONSOLE_PROJECT_ID}", cloud_handler)
app.router.add_get(f"/projects/{GOOGLE_CLOUD_CONSOLE_PROJECT_ID}/topics", cloud_handler)

client = await admin_client()
eligible_topics = await client.list_eligible_topics(DEVICE_ACCESS_PROJECT_ID)
Expand Down

0 comments on commit a083815

Please sign in to comment.