From fa62bc0e24ff0d798ffe928b9abce812a1a3898f Mon Sep 17 00:00:00 2001 From: Kristel Date: Sat, 28 Dec 2024 12:21:08 +0100 Subject: [PATCH] test, script and documentation improvements --- scripts/README.md | 33 ++++++++++++++++++ scripts/mnv-clean-verify.sh | 2 ++ scripts/mvn-clean-verify-site.sh | 6 +++- scripts/mvn-verify-site.sh | 6 +++- scripts/mvn-verify.sh | 2 ++ scripts/set-secrets.sh.example | 3 ++ scripts/test.sh | 3 ++ tado-api-test/README.md | 25 ++++++++++++++ .../tadoclient/apis/HomeControlApi_IT.kt | 31 ----------------- .../tadoclient/apis/ZoneControlApi_IT.kt | 34 +++++++++++++++++++ 10 files changed, 112 insertions(+), 33 deletions(-) create mode 100644 scripts/set-secrets.sh.example create mode 100644 scripts/test.sh diff --git a/scripts/README.md b/scripts/README.md index e69de29..9e165ca 100644 --- a/scripts/README.md +++ b/scripts/README.md @@ -0,0 +1,33 @@ +# How to use the `mvn-*.sh` scripts + +## Execute from parent directory + +The scripts are set-up in a way that they are expected to be executed from their parent directory. + +Example: + +`> ./scripts/mvn-clean-verify-site.sh` + +## Tado secrets required for integration tests + +The mvn scripts which include the `verify` goal execute the integration tests. +These tests expect environment variables to be present which contain your tado username and password. + +1. Lookup your tado username and password +2. In the `scripts` directory, create a file named `set-secrets.sh` which looks like this: + (see `set-secrets.sh.example` for an example) + +``` +#!/bin/bash +export TADO_USERNAME='' +export TADO_PASSWORD=' mvn clean verify -P local-api-spec` \ No newline at end of file diff --git a/tado-api-test/src/test/kotlin/tadoclient/apis/HomeControlApi_IT.kt b/tado-api-test/src/test/kotlin/tadoclient/apis/HomeControlApi_IT.kt index e258c46..fc566e0 100644 --- a/tado-api-test/src/test/kotlin/tadoclient/apis/HomeControlApi_IT.kt +++ b/tado-api-test/src/test/kotlin/tadoclient/apis/HomeControlApi_IT.kt @@ -97,37 +97,6 @@ class HomeControlApi_IT( } - @Test - @DisplayName("POST /homes/{homeId}/overlay") - @Order(10) - @EnabledIf(value = "isHomeConfigured", disabledReason = "no home specified in tado set-up") - fun setZoneOverlays() { - val newZoneOverlay = ZoneOverlay( - setting = ZoneSetting( - type = ZoneType.HEATING, - power = Power.ON, - temperature = Temperature(celsius = 16f) - ), - termination = ZoneOverlayTermination( - typeSkillBasedApp = ZoneOverlayTerminationTypeSkillBasedApp.TIMER, - durationInSeconds = 120 - ) - ) - val result = assertCorrectResponse { - tadoStrictHomeControlAPI.setZoneOverlays(tadoConfig.home!!.id, ZoneOverlays(listOf(ZoneOverlaysOverlaysInner(tadoConfig.zone!!.heating!!.id.toString(), newZoneOverlay))) ) - } - assertEquals(Unit, result) - } - - @Test - @DisplayName("DELETE /homes/{homeId}/overlay") - @Order(20) - @EnabledIf(value = "isHomeConfigured", disabledReason = "no home specified in tado set-up") - fun deleteZoneOverlays() { - val result = assertCorrectResponse { tadoStrictHomeControlAPI.deleteZoneOverlays(tadoConfig.home!!.id, rooms = listOf(tadoConfig.zone!!.heating!!.id) ) } - assertEquals(Unit, result) - } - @Test @DisplayName("PUT /homes/{homeId}/presenceLock") @Order(30) diff --git a/tado-api-test/src/test/kotlin/tadoclient/apis/ZoneControlApi_IT.kt b/tado-api-test/src/test/kotlin/tadoclient/apis/ZoneControlApi_IT.kt index 395472b..e8e63a3 100644 --- a/tado-api-test/src/test/kotlin/tadoclient/apis/ZoneControlApi_IT.kt +++ b/tado-api-test/src/test/kotlin/tadoclient/apis/ZoneControlApi_IT.kt @@ -112,6 +112,40 @@ class ZoneControlApi_IT( } } + @Test + @DisplayName("POST /homes/{homeId}/overlay") + @Order(4) +// @EnabledIf(value = "isHomeConfigured", disabledReason = "no home specified in tado set-up") + @Disabled("needs additional test set-up to revert back to the pre-test situation") + fun setZoneOverlays() { + val newZoneOverlay = ZoneOverlay( + setting = ZoneSetting( + type = ZoneType.HEATING, + power = Power.ON, + temperature = Temperature(celsius = 16f) + ), + termination = ZoneOverlayTermination( + typeSkillBasedApp = ZoneOverlayTerminationTypeSkillBasedApp.TIMER, + durationInSeconds = 120 + ) + ) + val result = assertCorrectResponse { + tadoStrictZoneControlAPI.setZoneOverlays(tadoConfig.home!!.id, ZoneOverlays(listOf(ZoneOverlaysOverlaysInner(tadoConfig.zone!!.heating!!.id.toString(), newZoneOverlay))) ) + } + assertEquals(Unit, result) + } + + @Test + @DisplayName("DELETE /homes/{homeId}/overlay") + @Order(7) +// @EnabledIf(value = "isHomeConfigured", disabledReason = "no home specified in tado set-up") + @Disabled("needs additional test set-up to revert back to the pre-test situation") + fun deleteZoneOverlays() { + val result = assertCorrectResponse { tadoStrictZoneControlAPI.deleteZoneOverlays(tadoConfig.home!!.id, rooms = listOf(tadoConfig.zone!!.heating!!.id) ) } + assertEquals(Unit, result) + } + + @Test @DisplayName("GET /homes/{homeId}/zones/{zoneId}/earlyStart") @Order(10)