Skip to content

Commit

Permalink
Fix bug with API.sensors.async_get_sensor not resolving (#23)
Browse files Browse the repository at this point in the history
  • Loading branch information
bachya authored Nov 22, 2022
1 parent 16a7479 commit db6269c
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion aiopurpleair/endpoints/sensors.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ async def async_get_sensor(
An API response payload in the form of a Pydantic model.
"""
response: GetSensorResponse = await self._async_endpoint_request_with_models(
f"/sensor/{sensor_index}",
f"/sensors/{sensor_index}",
(
("fields", fields),
("read_key", read_key),
Expand Down
4 changes: 2 additions & 2 deletions aiopurpleair/models/sensors.py
Original file line number Diff line number Diff line change
Expand Up @@ -348,7 +348,7 @@ def validate_location_type_response(cls, value: int) -> LocationType:


class GetSensorRequest(BaseModel):
"""Define a request to GET /v1/sensor/:sensor_index."""
"""Define a request to GET /v1/sensors/:sensor_index."""

fields: Optional[list[str]] = None
read_key: Optional[str] = None
Expand All @@ -365,7 +365,7 @@ class Config:


class GetSensorResponse(BaseModel):
"""Define a response to GET /v1/sensor/:sensor_index."""
"""Define a response to GET /v1/sensors/:sensor_index."""

api_version: str
sensor: SensorModel
Expand Down
6 changes: 3 additions & 3 deletions tests/endpoints/test_sensors.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,14 +56,14 @@ async def test_get_nearby_sensor_indicies(
async def test_get_sensor( # pylint: disable=too-many-statements
aresponses: ResponsesMockServer,
) -> None:
"""Test the GET /sensor/:sensor_index endpoint.
"""Test the GET /sensors/:sensor_index endpoint.
Args:
aresponses: An aresponses server.
"""
aresponses.add(
"api.purpleair.com",
"/v1/sensor/12345",
"/v1/sensors/12345",
"get",
response=aiohttp.web_response.json_response(
json.loads(load_fixture("get_sensor_response.json")), status=200
Expand Down Expand Up @@ -203,7 +203,7 @@ async def test_get_sensor( # pylint: disable=too-many-statements

@pytest.mark.asyncio
async def test_get_sensor_validation_error(aresponses: ResponsesMockServer) -> None:
"""Test the GET /sensor/:sensor_index endpoint, returning a validation error.
"""Test the GET /sensors/:sensor_index endpoint, returning a validation error.
Args:
aresponses: An aresponses server.
Expand Down

0 comments on commit db6269c

Please sign in to comment.