-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Tests for different combinations of wastetypes
- Loading branch information
1 parent
24ff4dd
commit 58b7bbf
Showing
5 changed files
with
285 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
<html> | ||
<head> | ||
</head> | ||
<body> | ||
<table> | ||
<tbody> | ||
<tr> | ||
<th class="mobile_no">Wochentag</th> | ||
<th>nächste Termine</th> | ||
<th>Abholungen</th> | ||
</tr> | ||
|
||
<tr> | ||
<td colspan="3" class="bg-light p-2"> | ||
<strong>Papier</strong> | ||
</td> | ||
</tr> | ||
<tr> | ||
<td valign="top" class="mobile_no p-1"><strong>Donnerstag</strong></td> | ||
<td valign="top" width="150px" class="p-1"><!-- ###SUCH_ERGEBNIS_FRAKTIONEN_NAECHSTE_TERMINE### start-->Do, 12.10.2023<br>Do, 19.10.2023<br>Do, 26.10.2023<br><br><!-- ###SUCH_ERGEBNIS_FRAKTIONEN_NAECHSTE_TERMINE### end--></td> | ||
<td valign="top" class="p-1">1x wöchentlich</td> | ||
</tr> | ||
<tr> | ||
<td colspan="3"> | ||
</td> | ||
</tr> | ||
|
||
<tr colspan="3"> | ||
<td class="p-2"></td> | ||
</tr> | ||
<tr> | ||
<td colspan="3" class="bg-light p-2"> | ||
<strong>Leichtverpackungen</strong> | ||
</td> | ||
</tr> | ||
<tr> | ||
<td valign="top" class="mobile_no p-1"><strong>Donnerstag</strong></td> | ||
<td valign="top" width="150px" class="p-1"><!-- ###SUCH_ERGEBNIS_FRAKTIONEN_NAECHSTE_TERMINE### start-->Do, 12.10.2023<br>Do, 19.10.2023<br>Do, 26.10.2023<br><br><!-- ###SUCH_ERGEBNIS_FRAKTIONEN_NAECHSTE_TERMINE### end--></td> | ||
<td valign="top" class="p-1">1x wöchentlich</td> | ||
</tr> | ||
<tr> | ||
<td colspan="3"> | ||
</td> | ||
</tr> | ||
</tbody> | ||
</table> | ||
|
||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,88 @@ | ||
<html> | ||
<head> | ||
</head> | ||
<body> | ||
<table> | ||
<tbody> | ||
<tr> | ||
<th class="mobile_no">Wochentag</th> | ||
<th>nächste Termine</th> | ||
<th>Abholungen</th> | ||
</tr> | ||
|
||
<tr colspan="3"> | ||
<td class="p-2"></td> | ||
</tr> | ||
<tr> | ||
<td colspan="3" class="bg-light p-2"> | ||
<strong>Restabfall</strong> | ||
</td> | ||
</tr> | ||
<tr> | ||
<td valign="top" class="mobile_no p-1"><strong>Mittwoch</strong></td> | ||
<td valign="top" width="150px" class="p-1"><!-- ###SUCH_ERGEBNIS_FRAKTIONEN_NAECHSTE_TERMINE### start-->Mi, 11.10.2023<br>Mi, 18.10.2023<br>Mi, 25.10.2023<br><br><!-- ###SUCH_ERGEBNIS_FRAKTIONEN_NAECHSTE_TERMINE### end--></td> | ||
<td valign="top" class="p-1">1x wöchentlich</td> | ||
</tr> | ||
<tr> | ||
<td colspan="3"> | ||
</td> | ||
</tr> | ||
|
||
<tr colspan="3"> | ||
<td class="p-2"></td> | ||
</tr> | ||
<tr> | ||
<td colspan="3" class="bg-light p-2"> | ||
<strong>Bioabfall</strong> | ||
</td> | ||
</tr> | ||
<tr> | ||
<td valign="top" class="mobile_no p-1"><strong>Donnerstag</strong></td> | ||
<td valign="top" width="150px" class="p-1"><!-- ###SUCH_ERGEBNIS_FRAKTIONEN_NAECHSTE_TERMINE### start-->Do, 12.10.2023<br>Do, 19.10.2023<br>Do, 26.10.2023<br><br><!-- ###SUCH_ERGEBNIS_FRAKTIONEN_NAECHSTE_TERMINE### end--></td> | ||
<td valign="top" class="p-1">1x wöchentlich</td> | ||
</tr> | ||
<tr> | ||
<td colspan="3"> | ||
</td> | ||
</tr> | ||
|
||
<tr colspan="3"> | ||
<td class="p-2"></td> | ||
</tr> | ||
<tr> | ||
<td colspan="3" class="bg-light p-2"> | ||
<strong>Papier</strong> | ||
</td> | ||
</tr> | ||
<tr> | ||
<td valign="top" class="mobile_no p-1"><strong>Freitag</strong></td> | ||
<td valign="top" width="150px" class="p-1"><!-- ###SUCH_ERGEBNIS_FRAKTIONEN_NAECHSTE_TERMINE### start-->Fr, 13.10.2023<br>Fr, 20.10.2023<br>Fr, 27.10.2023<br><br><!-- ###SUCH_ERGEBNIS_FRAKTIONEN_NAECHSTE_TERMINE### end--></td> | ||
<td valign="top" class="p-1">1x wöchentlich</td> | ||
</tr> | ||
<tr> | ||
<td colspan="3"> | ||
</td> | ||
</tr> | ||
|
||
<tr colspan="3"> | ||
<td class="p-2"></td> | ||
</tr> | ||
<tr> | ||
<td colspan="3" class="bg-light p-2"> | ||
<strong>Leichtverpackungen</strong> | ||
</td> | ||
</tr> | ||
<tr> | ||
<td valign="top" class="mobile_no p-1"><strong>Donnerstag</strong></td> | ||
<td valign="top" width="150px" class="p-1"><!-- ###SUCH_ERGEBNIS_FRAKTIONEN_NAECHSTE_TERMINE### start-->Do, 12.10.2023<br>Do, 19.10.2023<br>Do, 26.10.2023<br><br><!-- ###SUCH_ERGEBNIS_FRAKTIONEN_NAECHSTE_TERMINE### end--></td> | ||
<td valign="top" class="p-1">1x wöchentlich</td> | ||
</tr> | ||
<tr> | ||
<td colspan="3"> | ||
</td> | ||
</tr> | ||
</tbody> | ||
</table> | ||
|
||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,88 @@ | ||
<html> | ||
<head> | ||
</head> | ||
<body> | ||
<table> | ||
<tbody> | ||
<tr> | ||
<th class="mobile_no">Wochentag</th> | ||
<th>nächste Termine</th> | ||
<th>Abholungen</th> | ||
</tr> | ||
|
||
<tr colspan="3"> | ||
<td class="p-2"></td> | ||
</tr> | ||
<tr> | ||
<td colspan="3" class="bg-light p-2"> | ||
<strong>Restabfall 660/1.100 Liter</strong> | ||
</td> | ||
</tr> | ||
<tr> | ||
<td valign="top" class="mobile_no p-1"><strong>Mittwoch</strong></td> | ||
<td valign="top" width="150px" class="p-1"><!-- ###SUCH_ERGEBNIS_FRAKTIONEN_NAECHSTE_TERMINE### start-->Mi, 11.10.2023<br>Mi, 18.10.2023<br>Mi, 25.10.2023<br><br><!-- ###SUCH_ERGEBNIS_FRAKTIONEN_NAECHSTE_TERMINE### end--></td> | ||
<td valign="top" class="p-1">1x wöchentlich</td> | ||
</tr> | ||
<tr> | ||
<td colspan="3"> | ||
</td> | ||
</tr> | ||
|
||
<tr colspan="3"> | ||
<td class="p-2"></td> | ||
</tr> | ||
<tr> | ||
<td colspan="3" class="bg-light p-2"> | ||
<strong>Bioabfall</strong> | ||
</td> | ||
</tr> | ||
<tr> | ||
<td valign="top" class="mobile_no p-1"><strong>Donnerstag</strong></td> | ||
<td valign="top" width="150px" class="p-1"><!-- ###SUCH_ERGEBNIS_FRAKTIONEN_NAECHSTE_TERMINE### start-->Do, 12.10.2023<br>Do, 19.10.2023<br>Do, 26.10.2023<br><br><!-- ###SUCH_ERGEBNIS_FRAKTIONEN_NAECHSTE_TERMINE### end--></td> | ||
<td valign="top" class="p-1">1x wöchentlich</td> | ||
</tr> | ||
<tr> | ||
<td colspan="3"> | ||
</td> | ||
</tr> | ||
|
||
<tr colspan="3"> | ||
<td class="p-2"></td> | ||
</tr> | ||
<tr> | ||
<td colspan="3" class="bg-light p-2"> | ||
<strong>Papier</strong> | ||
</td> | ||
</tr> | ||
<tr> | ||
<td valign="top" class="mobile_no p-1"><strong>Freitag</strong></td> | ||
<td valign="top" width="150px" class="p-1"><!-- ###SUCH_ERGEBNIS_FRAKTIONEN_NAECHSTE_TERMINE### start-->Fr, 13.10.2023<br>Fr, 20.10.2023<br>Fr, 27.10.2023<br><br><!-- ###SUCH_ERGEBNIS_FRAKTIONEN_NAECHSTE_TERMINE### end--></td> | ||
<td valign="top" class="p-1">1x wöchentlich</td> | ||
</tr> | ||
<tr> | ||
<td colspan="3"> | ||
</td> | ||
</tr> | ||
|
||
<tr colspan="3"> | ||
<td class="p-2"></td> | ||
</tr> | ||
<tr> | ||
<td colspan="3" class="bg-light p-2"> | ||
<strong>Leichtverpackungen</strong> | ||
</td> | ||
</tr> | ||
<tr> | ||
<td valign="top" class="mobile_no p-1"><strong>Donnerstag</strong></td> | ||
<td valign="top" width="150px" class="p-1"><!-- ###SUCH_ERGEBNIS_FRAKTIONEN_NAECHSTE_TERMINE### start-->Do, 12.10.2023<br>Do, 19.10.2023<br>Do, 26.10.2023<br><br><!-- ###SUCH_ERGEBNIS_FRAKTIONEN_NAECHSTE_TERMINE### end--></td> | ||
<td valign="top" class="p-1">1x wöchentlich</td> | ||
</tr> | ||
<tr> | ||
<td colspan="3"> | ||
</td> | ||
</tr> | ||
</tbody> | ||
</table> | ||
|
||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
"""Tests for coordinator.""" | ||
from unittest.mock import AsyncMock | ||
|
||
import pytest | ||
|
||
from custom_components.aha_region.coordinator import AhaApi | ||
|
||
|
||
@pytest.mark.asyncio | ||
async def test_get_data_restabfall(): | ||
"""Test with 4 wastetypes and regular 'Restabfall'.""" | ||
with open("tests/responses/response_restabfall.html") as file: | ||
response = AsyncMock() | ||
response.text.return_value = file.read() | ||
session = AsyncMock() | ||
session.post.return_value = response | ||
api = AhaApi(session, "", "", "", "", "") | ||
data = await api.get_data() | ||
|
||
assert len(data) == 4 | ||
assert data["Restabfall"] == "Mi, 11.10.2023" | ||
assert data["Bioabfall"] == "Do, 12.10.2023" | ||
assert data["Papier"] == "Fr, 13.10.2023" | ||
assert data["Leichtverpackungen"] == "Do, 12.10.2023" | ||
|
||
|
||
@pytest.mark.asyncio | ||
async def test_get_data_restabfall_660(): | ||
"""Test with 4 wastetypes and 'Restabfall 660/1.000 Liter'.""" | ||
with open("tests/responses/response_restabfall_660.html") as file: | ||
response = AsyncMock() | ||
response.text.return_value = file.read() | ||
session = AsyncMock() | ||
session.post.return_value = response | ||
api = AhaApi(session, "", "", "", "", "") | ||
data = await api.get_data() | ||
|
||
assert len(data) == 4 | ||
assert data["Restabfall 660/1.100 Liter"] == "Mi, 11.10.2023" | ||
assert data["Bioabfall"] == "Do, 12.10.2023" | ||
assert data["Papier"] == "Fr, 13.10.2023" | ||
assert data["Leichtverpackungen"] == "Do, 12.10.2023" | ||
|
||
|
||
@pytest.mark.asyncio | ||
async def test_get_data_papier_leichtverpackungen(): | ||
"""Test with just 2 types of waste collected.""" | ||
with open("tests/responses/response_papier_leichtverpackungen.html") as file: | ||
response = AsyncMock() | ||
response.text.return_value = file.read() | ||
session = AsyncMock() | ||
session.post.return_value = response | ||
api = AhaApi(session, "", "", "", "", "") | ||
data = await api.get_data() | ||
|
||
assert len(data) == 2 | ||
assert data["Papier"] == "Do, 12.10.2023" | ||
assert data["Leichtverpackungen"] == "Do, 12.10.2023" |