Skip to content

Commit

Permalink
Changes argument order of resources state API
Browse files Browse the repository at this point in the history
  • Loading branch information
giffels committed Jan 11, 2022
1 parent e9c4ea7 commit ee18261
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
4 changes: 2 additions & 2 deletions docs/source/changelog.rst
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
.. Created by changelog.py at 2021-12-20, command
.. Created by changelog.py at 2022-01-11, command
'/Users/giffler/.cache/pre-commit/repor6pnmwlm/py_env-default/bin/changelog docs/source/changes compile --output=docs/source/changelog.rst'
based on the format of 'https://keepachangelog.com/'
#########
CHANGELOG
#########

[Unreleased] - 2021-12-20
[Unreleased] - 2022-01-11
=========================

Added
Expand Down
2 changes: 1 addition & 1 deletion tardis/rest/app/routers/resources.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
router = APIRouter(prefix="/resources", tags=["resources"])


@router.get("/state/{drone_uuid}", description="Get current state of a resource")
@router.get("/{drone_uuid}/state", description="Get current state of a resource")
async def get_resource_state(
drone_uuid: str = Path(..., regex=r"^\S+-[A-Fa-f0-9]{10}$"),
sql_registry: SqliteRegistry = Depends(database.get_sql_registry()),
Expand Down
6 changes: 3 additions & 3 deletions tests/rest_t/routers_t/test_resources.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ def test_get_resource_state(self):
)

response = run_async(
self.client.get, "/resources/state/test-0123456789", headers=self.headers
self.client.get, "/resources/test-0123456789/state", headers=self.headers
)
self.assertEqual(response.status_code, 200)
self.assertEqual(
Expand All @@ -22,13 +22,13 @@ def test_get_resource_state(self):

self.mock_crud.get_resource_state.return_value = async_return(return_value=[])
response = run_async(
self.client.get, "/resources/state/test-1234567890", headers=self.headers
self.client.get, "/resources/test-1234567890/state", headers=self.headers
)
self.assertEqual(response.status_code, 404)
self.assertEqual(response.json(), {"detail": "Drone not found"})

response = run_async(
self.client.get, "/resources/state/test-invalid", headers=self.headers
self.client.get, "/resources/test-invalid/state", headers=self.headers
)
self.assertEqual(response.status_code, 422)
self.assertEqual(
Expand Down

0 comments on commit ee18261

Please sign in to comment.