|
51 | 51 | class TestPlugwise: # pylint: disable=attribute-defined-outside-init |
52 | 52 | """Tests for Plugwise Smile.""" |
53 | 53 |
|
54 | | - async def _write_json(self, call, data): |
| 54 | + async def _write_json(self, file_path, call, data): |
55 | 55 | """Store JSON data to per-setup files for HA component testing.""" |
56 | 56 | no_fixtures = os.getenv("NO_FIXTURES") == "1" |
57 | 57 | if no_fixtures: |
58 | 58 | return # pragma: no cover |
59 | 59 |
|
60 | 60 | path = os.path.join( |
61 | | - os.path.dirname(__file__), "../fixtures/" + self.smile_setup |
| 61 | + os.path.dirname(__file__), file_path, |
62 | 62 | ) |
63 | 63 | datafile = os.path.join(path, call + ".json") |
64 | 64 | if not os.path.exists(path): # pragma: no cover |
@@ -580,10 +580,21 @@ def test_and_assert(test_dict, data, header): |
580 | 580 | "cooling_state" |
581 | 581 | ] |
582 | 582 |
|
583 | | - await self._write_json("data", data) |
| 583 | + await self._write_json("../fixtures/" + self.smile_setup, "data", data) |
| 584 | + prefix = "dummy" |
| 585 | + _LOGGER.debug("HOI smile_setup = %s", self.smile_setup) |
| 586 | + if str(self.smile_setup).startswith("adam"): |
| 587 | + _LOGGER.debug("HOI starts with adam = True") |
| 588 | + prefix = "adam" |
| 589 | + if str(self.smile_setup).startswith("anna"): |
| 590 | + _LOGGER.debug("HOI starts with anna = True") |
| 591 | + prefix = "anna" |
| 592 | + _LOGGER.debug("HOI prefix = %s", prefix) |
| 593 | + _LOGGER.debug("HOI path = %s", f"../tests/data/{prefix}/") |
| 594 | + await self._write_json(f"../tests/data/{prefix}/", self.smile_setup, {"devices": data}) |
584 | 595 |
|
585 | 596 | if "FIXTURES" in os.environ: |
586 | | - _LOGGER.info("Skipping tests: Requested fixtures only") # pragma: no cover |
| 597 | + _LOGGER.info("Skipping tests-: Requested fixtures only") # pragma: no cover |
587 | 598 | return # pragma: no cover |
588 | 599 |
|
589 | 600 | self.entity_list = list(data.keys()) |
|
0 commit comments