@@ -16,7 +16,7 @@ import kotlin.test.assertEquals
16
16
import kotlin.test.assertNotEquals
17
17
import kotlin.test.assertNotNull
18
18
19
- @SpringBootTest(classes = arrayOf( Application ::class ) )
19
+ @SpringBootTest(classes = [ Application ::class ] )
20
20
@TestMethodOrder(MethodOrderer .OrderAnnotation ::class )
21
21
@DisplayName(" tado API - zone control" )
22
22
class ZoneControlApi_IT (
@@ -32,8 +32,8 @@ class ZoneControlApi_IT(
32
32
@Autowired
33
33
tadoConfig : TadoConfig
34
34
) : BaseTest(tadoConfig) {
35
- val tadoZoneControlAPI = ZoneControlApi (tadoRestClient)
36
- val tadoStrictZoneControlAPI = ZoneControlApi (tadoStrictRestClient)
35
+ private val tadoZoneControlAPI = ZoneControlApi (tadoRestClient)
36
+ private val tadoStrictZoneControlAPI = ZoneControlApi (tadoStrictRestClient)
37
37
38
38
39
39
private var defaultZoneOverlayBeforeTest: DefaultZoneOverlay ? = null
@@ -50,17 +50,17 @@ class ZoneControlApi_IT(
50
50
@BeforeAll
51
51
fun before () = try {
52
52
defaultZoneOverlayBeforeTest = tadoZoneControlAPI.getDefaultZoneOverlay(tadoConfig.home!! .id, tadoConfig.zone!! .heating!! .id)
53
- earlyStartBeforeTest = tadoZoneControlAPI.getEarlyStart(tadoConfig.home!! .id, tadoConfig.zone!! .heating!! .id)
54
- zoneOverlayBeforeTest = tadoZoneControlAPI.getZoneOverlay(tadoConfig.home!! .id, tadoConfig.zone!! .heating!! .id)
55
- zoneAwayConfigurationBeforeTest = tadoZoneControlAPI.getAwayConfiguration(tadoConfig.home!! .id, tadoConfig.zone!! .heating!! .id)
56
- activeTimetableTypeBeforeStart = tadoZoneControlAPI.getActiveTimetableType(tadoConfig.home!! .id, tadoConfig.zone!! .heating!! .id)
53
+ earlyStartBeforeTest = tadoZoneControlAPI.getEarlyStart(tadoConfig.home.id, tadoConfig.zone.heating!! .id)
54
+ zoneOverlayBeforeTest = tadoZoneControlAPI.getZoneOverlay(tadoConfig.home.id, tadoConfig.zone.heating.id)
55
+ zoneAwayConfigurationBeforeTest = tadoZoneControlAPI.getAwayConfiguration(tadoConfig.home.id, tadoConfig.zone.heating.id)
56
+ activeTimetableTypeBeforeStart = tadoZoneControlAPI.getActiveTimetableType(tadoConfig.home.id, tadoConfig.zone.heating.id)
57
57
} catch (e: Exception ) {
58
58
// ignore
59
59
}
60
60
61
61
// reset the overlay status to the state it had before we started running the tests
62
62
// TODO: conditionally on presence of set-up
63
- @AfterAll()
63
+ @AfterAll
64
64
fun after () {
65
65
// EarlyStart
66
66
earlyStartBeforeTest?.let {
@@ -220,8 +220,8 @@ class ZoneControlApi_IT(
220
220
tadoStrictZoneControlAPI.setZoneOverlay(tadoConfig.home!! .id, tadoConfig.zone!! .heating!! .id, zoneOverlay1)
221
221
222
222
// now we can test
223
- val zoneOverlay = assertCorrectResponse { tadoStrictZoneControlAPI.getZoneOverlay(tadoConfig.home!! .id, tadoConfig.zone!! .heating!! .id) }
224
- verifyZoneOverlay(Pair ( ZoneType . HEATING , true ), zoneOverlay, endpoint )
223
+ val zoneOverlay = assertCorrectResponse { tadoStrictZoneControlAPI.getZoneOverlay(tadoConfig.home.id, tadoConfig.zone.heating!! .id) }
224
+ verifyZoneOverlay(zoneOverlay, endpoint, ancestorObjectProps = mapOf ( ZONE_TYPE to ZoneType . HEATING ) )
225
225
}
226
226
227
227
@Test
@@ -234,7 +234,7 @@ class ZoneControlApi_IT(
234
234
235
235
// now we can test
236
236
assertHttpErrorStatus(HttpStatus .NOT_FOUND ) {
237
- tadoStrictZoneControlAPI.getZoneOverlay(tadoConfig.home!! .id, tadoConfig.zone!! .heating!! .id)
237
+ tadoStrictZoneControlAPI.getZoneOverlay(tadoConfig.home.id, tadoConfig.zone.heating!! .id)
238
238
}
239
239
}
240
240
@@ -267,8 +267,8 @@ class ZoneControlApi_IT(
267
267
power = Power .OFF ),
268
268
termination = ZoneOverlayTermination (typeSkillBasedApp = ZoneOverlayTerminationTypeSkillBasedApp .MANUAL )
269
269
)
270
- val result = assertCorrectResponse { tadoStrictZoneControlAPI.setZoneOverlay(tadoConfig.home!! .id, tadoConfig.zone!! .heating!! .id, zoneOverlay) }
271
- verifyZoneOverlay(Pair ( ZoneType . HEATING , true ), result, endpoint )
270
+ val result = assertCorrectResponse { tadoStrictZoneControlAPI.setZoneOverlay(tadoConfig.home.id, tadoConfig.zone.heating!! .id, zoneOverlay) }
271
+ verifyZoneOverlay(result, endpoint, ancestorObjectProps = mapOf ( ZONE_TYPE to ZoneType . HEATING ) )
272
272
}
273
273
274
274
// result:
@@ -293,8 +293,8 @@ class ZoneControlApi_IT(
293
293
),
294
294
termination = ZoneOverlayTermination (typeSkillBasedApp = ZoneOverlayTerminationTypeSkillBasedApp .MANUAL )
295
295
)
296
- val result = assertCorrectResponse { tadoStrictZoneControlAPI.setZoneOverlay(tadoConfig.home!! .id, tadoConfig.zone!! .heating!! .id, zoneOverlay) }
297
- verifyZoneOverlay(Pair ( ZoneType . HEATING , true ), result, endpoint )
296
+ val result = assertCorrectResponse { tadoStrictZoneControlAPI.setZoneOverlay(tadoConfig.home.id, tadoConfig.zone.heating!! .id, zoneOverlay) }
297
+ verifyZoneOverlay(result, endpoint, ancestorObjectProps = mapOf ( ZONE_TYPE to ZoneType . HEATING ) )
298
298
}
299
299
300
300
// Result:
@@ -339,8 +339,8 @@ class ZoneControlApi_IT(
339
339
),
340
340
termination = ZoneOverlayTermination (typeSkillBasedApp = ZoneOverlayTerminationTypeSkillBasedApp .TADO_MODE )
341
341
)
342
- val result = assertCorrectResponse { tadoStrictZoneControlAPI.setZoneOverlay(tadoConfig.home!! .id, tadoConfig.zone!! .heating!! .id, zoneOverlay) }
343
- verifyZoneOverlay(Pair ( ZoneType . HEATING , true ), result, endpoint )
342
+ val result = assertCorrectResponse { tadoStrictZoneControlAPI.setZoneOverlay(tadoConfig.home.id, tadoConfig.zone.heating!! .id, zoneOverlay) }
343
+ verifyZoneOverlay(result, endpoint, ancestorObjectProps = mapOf ( ZONE_TYPE to ZoneType . HEATING ) )
344
344
}
345
345
346
346
@@ -365,8 +365,8 @@ class ZoneControlApi_IT(
365
365
),
366
366
termination = ZoneOverlayTermination (typeSkillBasedApp = ZoneOverlayTerminationTypeSkillBasedApp .NEXT_TIME_BLOCK )
367
367
)
368
- val result = assertCorrectResponse { tadoStrictZoneControlAPI.setZoneOverlay(tadoConfig.home!! .id, tadoConfig.zone!! .heating!! .id, zoneOverlay) }
369
- verifyZoneOverlay(Pair ( ZoneType . HEATING , true ), result, endpoint )
368
+ val result = assertCorrectResponse { tadoStrictZoneControlAPI.setZoneOverlay(tadoConfig.home.id, tadoConfig.zone.heating!! .id, zoneOverlay) }
369
+ verifyZoneOverlay(result, endpoint, ancestorObjectProps = mapOf ( ZONE_TYPE to ZoneType . HEATING ) )
370
370
}
371
371
372
372
// Result:
@@ -396,8 +396,8 @@ class ZoneControlApi_IT(
396
396
durationInSeconds = 1000
397
397
)
398
398
)
399
- val result = assertCorrectResponse { tadoStrictZoneControlAPI.setZoneOverlay(tadoConfig.home!! .id, tadoConfig.zone!! .heating!! .id, zoneOverlay) }
400
- verifyZoneOverlay(Pair ( ZoneType . HEATING , true ), result, endpoint )
399
+ val result = assertCorrectResponse { tadoStrictZoneControlAPI.setZoneOverlay(tadoConfig.home.id, tadoConfig.zone.heating!! .id, zoneOverlay) }
400
+ verifyZoneOverlay(result, endpoint, ancestorObjectProps = mapOf ( ZONE_TYPE to ZoneType . HEATING ) )
401
401
}
402
402
403
403
@Test
@@ -417,7 +417,7 @@ class ZoneControlApi_IT(
417
417
val endpoint = " GET /homes/{homeId}/zones/{zoneId}/schedule/awayConfiguration"
418
418
val awayConfiguration = assertCorrectResponse { tadoStrictZoneControlAPI.getAwayConfiguration(tadoConfig.home!! .id, tadoConfig.zone!! .heating!! .id) }
419
419
assertNotNull(awayConfiguration)
420
- verifyZoneAwayConfiguration(Pair ( ZoneType . HEATING , true ), awayConfiguration, endpoint )
420
+ verifyZoneAwayConfiguration(awayConfiguration, endpoint, ancestorObjectProps = mapOf ( ZONE_TYPE to ZoneType . HEATING ) )
421
421
}
422
422
423
423
@Test
@@ -495,7 +495,7 @@ class ZoneControlApi_IT(
495
495
}
496
496
assertNotNull(timetableBlocks)
497
497
assertNotEquals(0 , timetableBlocks.size)
498
- verifyTimetableBlock(Pair ( ZoneType . HEATING , true ), timetableBlocks[0 ], endpoint)
498
+ verifyTimetableBlock(timetableBlocks[0 ], endpoint, ancestorObjectProps = mapOf ( ZONE_TYPE to ZoneType . HEATING ) )
499
499
}
500
500
501
501
@Test
@@ -509,7 +509,7 @@ class ZoneControlApi_IT(
509
509
}
510
510
assertNotNull(timetableBlocks)
511
511
assertNotEquals(0 , timetableBlocks.size)
512
- verifyTimetableBlock(Pair ( ZoneType . HEATING , true ), timetableBlocks[0 ], endpoint)
512
+ verifyTimetableBlock(timetableBlocks[0 ], endpoint, ancestorObjectProps = mapOf ( ZONE_TYPE to ZoneType . HEATING ) )
513
513
}
514
514
515
515
@Test
@@ -524,10 +524,10 @@ class ZoneControlApi_IT(
524
524
// ... and use that as the input for the PUT call
525
525
// returned 500 Internal Server Error: "Please contact customer support"
526
526
val response = assertCorrectResponse {
527
- tadoStrictZoneControlAPI.setTimetableBlocksForDayType(tadoConfig.home!! .id, tadoConfig.zone!! .heating!! .id, TimetableTypeId ._1 , DayType .SATURDAY , timetableBlocks)
527
+ tadoStrictZoneControlAPI.setTimetableBlocksForDayType(tadoConfig.home.id, tadoConfig.zone.heating!! .id, TimetableTypeId ._1 , DayType .SATURDAY , timetableBlocks)
528
528
}
529
529
assertNotNull(timetableBlocks)
530
530
assertNotEquals(0 , response.size)
531
- verifyTimetableBlock(Pair ( ZoneType . HEATING , true ), response[0 ], endpoint)
531
+ verifyTimetableBlock(response[0 ], endpoint, ancestorObjectProps = mapOf ( ZONE_TYPE to ZoneType . HEATING ) )
532
532
}
533
533
}
0 commit comments