@@ -333,12 +333,12 @@ def test_update(mock_request, customer_details, status_schedule):
333
333
mock_request .assert_has_calls (
334
334
[
335
335
mock .call (
336
- "https://app .hydrawise.com/api/v1/customerdetails.php" ,
336
+ "https://api .hydrawise.com/api/v1/customerdetails.php" ,
337
337
params = {"api_key" : API_KEY , "type" : "controllers" },
338
338
timeout = 10 ,
339
339
),
340
340
mock .call (
341
- "https://app .hydrawise.com/api/v1/statusschedule.php" ,
341
+ "https://api .hydrawise.com/api/v1/statusschedule.php" ,
342
342
params = {"api_key" : API_KEY },
343
343
timeout = 10 ,
344
344
),
@@ -399,7 +399,7 @@ def test_suspend_zone(mock_request, success_status):
399
399
with freeze_time ("1970-01-01 00:00:00" ) as t :
400
400
assert client .suspend_zone (1 , 1 ) == success_status
401
401
mock_request .assert_called_once_with (
402
- "https://app .hydrawise.com/api/v1/setzone.php" ,
402
+ "https://api .hydrawise.com/api/v1/setzone.php" ,
403
403
params = {
404
404
"api_key" : API_KEY ,
405
405
"action" : "suspend" ,
@@ -411,6 +411,27 @@ def test_suspend_zone(mock_request, success_status):
411
411
)
412
412
413
413
414
+ def test_suspend_zone_unsuspend (mock_request , success_status ):
415
+ client = legacy .LegacyHydrawise (API_KEY )
416
+ mock_request .reset_mock (return_value = True , side_effect = True )
417
+
418
+ mock_request .return_value .status_code = 200
419
+ mock_request .return_value .json .return_value = success_status
420
+
421
+ with freeze_time ("1970-01-01 00:00:00" ) as t :
422
+ assert client .suspend_zone (0 , 1 ) == success_status
423
+ mock_request .assert_called_once_with (
424
+ "https://api.hydrawise.com/api/v1/setzone.php" ,
425
+ params = {
426
+ "api_key" : API_KEY ,
427
+ "action" : "suspend" ,
428
+ "period_id" : 0 ,
429
+ "relay_id" : 428639 ,
430
+ },
431
+ timeout = 10 ,
432
+ )
433
+
434
+
414
435
def test_suspend_zone_all (mock_request , success_status ):
415
436
client = legacy .LegacyHydrawise (API_KEY )
416
437
mock_request .reset_mock (return_value = True , side_effect = True )
@@ -421,7 +442,7 @@ def test_suspend_zone_all(mock_request, success_status):
421
442
with freeze_time ("1970-01-01 00:00:00" ) as t :
422
443
assert client .suspend_zone (1 ) == success_status
423
444
mock_request .assert_called_once_with (
424
- "https://app .hydrawise.com/api/v1/setzone.php" ,
445
+ "https://api .hydrawise.com/api/v1/setzone.php" ,
425
446
params = {
426
447
"api_key" : API_KEY ,
427
448
"action" : "suspendall" ,
@@ -442,7 +463,7 @@ def test_run_zone(mock_request, success_status):
442
463
with freeze_time ("1970-01-01 00:00:00" ) as t :
443
464
assert client .run_zone (1 , 1 ) == success_status
444
465
mock_request .assert_called_once_with (
445
- "https://app .hydrawise.com/api/v1/setzone.php" ,
466
+ "https://api .hydrawise.com/api/v1/setzone.php" ,
446
467
params = {
447
468
"api_key" : API_KEY ,
448
469
"action" : "run" ,
@@ -464,7 +485,7 @@ def test_run_zone_all(mock_request, success_status):
464
485
with freeze_time ("1970-01-01 00:00:00" ) as t :
465
486
assert client .run_zone (1 ) == success_status
466
487
mock_request .assert_called_once_with (
467
- "https://app .hydrawise.com/api/v1/setzone.php" ,
488
+ "https://api .hydrawise.com/api/v1/setzone.php" ,
468
489
params = {
469
490
"api_key" : API_KEY ,
470
491
"action" : "runall" ,
@@ -485,10 +506,11 @@ def test_run_zone_stop(mock_request, success_status):
485
506
with freeze_time ("1970-01-01 00:00:00" ) as t :
486
507
assert client .run_zone (0 , 1 ) == success_status
487
508
mock_request .assert_called_once_with (
488
- "https://app .hydrawise.com/api/v1/setzone.php" ,
509
+ "https://api .hydrawise.com/api/v1/setzone.php" ,
489
510
params = {
490
511
"api_key" : API_KEY ,
491
512
"action" : "stop" ,
513
+ "period_id" : 0 ,
492
514
"relay_id" : 428639 ,
493
515
},
494
516
timeout = 10 ,
@@ -505,10 +527,11 @@ def test_run_zone_stop_all(mock_request, success_status):
505
527
with freeze_time ("1970-01-01 00:00:00" ) as t :
506
528
assert client .run_zone (0 ) == success_status
507
529
mock_request .assert_called_once_with (
508
- "https://app .hydrawise.com/api/v1/setzone.php" ,
530
+ "https://api .hydrawise.com/api/v1/setzone.php" ,
509
531
params = {
510
532
"api_key" : API_KEY ,
511
533
"action" : "stopall" ,
534
+ "period_id" : 0 ,
512
535
},
513
536
timeout = 10 ,
514
537
)
0 commit comments