Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Jan 23, 2026

The get_asset method was recently added to fetch a single asset using the dedicated /api/v3_0/assets/{asset_id} endpoint, but lacked test coverage.

Changes

  • Added test_get_asset to tests/test_client.py following existing test patterns
  • Test validates correct endpoint usage, response parsing, and return value
@pytest.mark.asyncio
async def test_get_asset() -> None:
    with aioresponses() as m:
        flexmeasures_client = FlexMeasuresClient(
            email="test@test.test", password="test"
        )
        flexmeasures_client.access_token = "test-token"
        m.get(
            "http://localhost:5000/api/v3_0/assets/3",
            status=200,
            payload={
                "account_id": 2,
                "id": 3,
                "name": "toy-battery",
                # ...
            },
        )

        asset = await flexmeasures_client.get_asset(asset_id=3)
        assert asset["id"] == 3
        assert asset["name"] == "toy-battery"

💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

Co-authored-by: Flix6x <30658763+Flix6x@users.noreply.github.com>
Copilot AI changed the title [WIP] Add tests for fetch one asset method Add test for get_asset method Jan 23, 2026
Copilot AI requested a review from Flix6x January 23, 2026 09:35
@Flix6x Flix6x marked this pull request as ready for review January 23, 2026 09:40
@Flix6x Flix6x merged commit 322aaf1 into feat/fetch-one-asset Jan 23, 2026
1 check passed
@Flix6x Flix6x deleted the copilot/sub-pr-159 branch January 23, 2026 09:40
Flix6x added a commit that referenced this pull request Jan 23, 2026
* feat: client.get_asset

Signed-off-by: F.N. Claessen <felix@seita.nl>

* feat: get all fields instead, by using the dedicated endpoint for fetching a single asset

Signed-off-by: F.N. Claessen <felix@seita.nl>

* style: mypy

Signed-off-by: F.N. Claessen <felix@seita.nl>

* Add test for get_asset method (#160)

* Initial plan

* test: add test for get_asset method

Co-authored-by: Flix6x <30658763+Flix6x@users.noreply.github.com>

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: Flix6x <30658763+Flix6x@users.noreply.github.com>

---------

Signed-off-by: F.N. Claessen <felix@seita.nl>
Co-authored-by: Copilot <198982749+Copilot@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants