Skip to content

Commit

Permalink
fix(api): Remove values length check on bewegungsdaten call
Browse files Browse the repository at this point in the history
  • Loading branch information
DarwinsBuddy committed Nov 12, 2024
1 parent 1f9498a commit 1414e74
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 15 deletions.
2 changes: 0 additions & 2 deletions custom_components/wnsm/api/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -508,6 +508,4 @@ def bewegungsdaten(
)
if data["descriptor"]["zaehlpunktnummer"] != zaehlpunkt:
raise SmartmeterQueryError("Returned data does not match given zaehlpunkt!")
if len(data["values"]) == 0:
raise SmartmeterQueryError("Historical data is empty")
return data
13 changes: 0 additions & 13 deletions tests/it/test_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -319,19 +319,6 @@ def test_bewegungsdaten_wrong_zp(requests_mock: Mocker):
with pytest.raises(SmartmeterQueryError) as exc_info:
smartmeter().login().bewegungsdaten(None, dateFrom, dateTo)
assert 'Returned data does not match given zaehlpunkt!' == str(exc_info.value)

@pytest.mark.usefixtures("requests_mock")
def test_bewegungsdaten_empty_values(requests_mock: Mocker):
z = zaehlpunkt_response([enabled(zaehlpunkt())])[0]
dateFrom = dt.datetime(2023, 4, 21, 00, 00, 00, 0)
dateTo = dt.datetime(2023, 5, 1, 23, 59, 59, 999999)
zpn = z["zaehlpunkte"][0]['zaehlpunktnummer']
expect_login(requests_mock)
expect_bewegungsdaten(requests_mock, z["geschaeftspartner"], zpn, dateFrom, dateTo, empty_values = True)
expect_zaehlpunkte(requests_mock, [enabled(zaehlpunkt())])
with pytest.raises(SmartmeterQueryError) as exc_info:
smartmeter().login().bewegungsdaten(None, dateFrom, dateTo)
assert 'Historical data is empty' == str(exc_info.value)


@pytest.mark.usefixtures("requests_mock")
Expand Down

0 comments on commit 1414e74

Please sign in to comment.