Skip to content

Commit cbc8ea0

Browse files
tests: add test to check for successful wol sends
1 parent d8abd7b commit cbc8ea0

1 file changed

Lines changed: 11 additions & 0 deletions

File tree

pfSense-pkg-RESTAPI/files/etc/inc/RESTAPI/Tests/APIModelsWakeOnLANSendTestCase.inc

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ class APIModelsWakeOnLANSendTestCase extends TestCase
4242
* Checks that the _create() method throws an error if the wol command fails for any reason.
4343
*/
4444
public function test_error_thrown_if_wol_cmd_fails(): void {
45+
# Ensure an error is thrown if the wol command fails (i.e. the mac address is somehow invalid, etc.)
4546
$this->assert_throws_response(
4647
response_id: "WAKE_ON_LAN_SEND_COMMAND_FAILED",
4748
code: 500,
@@ -52,5 +53,15 @@ class APIModelsWakeOnLANSendTestCase extends TestCase
5253
$wol->_create();
5354
}
5455
);
56+
57+
# Ensure no error is thrown when the wol command is successful
58+
$this->assert_does_not_throw(
59+
callable: function () {
60+
$wol = new WakeOnLANSend();
61+
$wol->interface->value = "lan";
62+
$wol->mac_addr->value = "00:00:00:00:00:00";
63+
$wol->_create();
64+
}
65+
);
5566
}
5667
}

0 commit comments

Comments
 (0)