diff --git a/pfSense-pkg-API/files/etc/inc/api/tests/APIModelsAPISettingsTestCase.inc b/pfSense-pkg-API/files/etc/inc/api/tests/APIModelsAPISettingsTestCase.inc index a258d0d39..9040a76a4 100644 --- a/pfSense-pkg-API/files/etc/inc/api/tests/APIModelsAPISettingsTestCase.inc +++ b/pfSense-pkg-API/files/etc/inc/api/tests/APIModelsAPISettingsTestCase.inc @@ -400,90 +400,6 @@ class APIModelsAPISettingsTestCase extends TestCase ); } - /** - * Checks that validation on the `key_hash_algo` field works as intended. - */ - public function test_key_hash_algo() { - # Ensure value must be a string - $this->assert_throws_response( - "FIELD_INVALID_TYPE", - code: 400, - callable: function () { - $api_settings = new APISettings( - representation_data: ["key_hash_algo" => 0] - ); - $api_settings->validate(); - } - ); - - # Ensure values must be either `sha256`, `sha384`, or `sha512` - $this->assert_throws_response( - "FIELD_INVALID_CHOICE", - code: 400, - callable: function () { - $api_settings = new APISettings( - representation_data: ["key_hash_algo" => "not a valid choice"] - ); - $api_settings->validate(); - } - ); - - # Ensure valid values are accepted - $this->assert_does_not_throw( - callable: function () { - $api_settings = new APISettings(representation_data: ["key_hash_algo" => "sha256"]); - $api_settings->validate(); - $api_settings = new APISettings(representation_data: ["key_hash_algo" => "sha384"]); - $api_settings->validate(); - $api_settings = new APISettings(representation_data: ["key_hash_algo" => "sha512"]); - $api_settings->validate(); - } - ); - } - - /** - * Checks that validation on the `key_length_bytes` field works as intended. - */ - public function test_key_length_bytes() { - # Ensure value must be an integer - $this->assert_throws_response( - "FIELD_INVALID_TYPE", - code: 400, - callable: function () { - $api_settings = new APISettings( - representation_data: ["key_length_bytes" => "not an integer"] - ); - $api_settings->validate(); - } - ); - - # Ensure values must be either `16`, `24`, `32` or `64` - $this->assert_throws_response( - "FIELD_INVALID_CHOICE", - code: 400, - callable: function () { - $api_settings = new APISettings( - representation_data: ["key_length_bytes" => 12] - ); - $api_settings->validate(); - } - ); - - # Ensure valid values are accepted - $this->assert_does_not_throw( - callable: function () { - $api_settings = new APISettings(representation_data: ["key_length_bytes" => 16]); - $api_settings->validate(); - $api_settings = new APISettings(representation_data: ["key_length_bytes" => 24]); - $api_settings->validate(); - $api_settings = new APISettings(representation_data: ["key_length_bytes" => 32]); - $api_settings->validate(); - $api_settings = new APISettings(representation_data: ["key_length_bytes" => 64]); - $api_settings->validate(); - } - ); - } - /** * Checks that validation on the `ha_sync` field works as intended. */