summaryrefslogtreecommitdiff
path: root/tests/spec/validator_spec.rb
diff options
context:
space:
mode:
authorA. Wilcox <AWilcox@Wilcox-Tech.com>2019-10-24 02:20:33 -0500
committerA. Wilcox <AWilcox@Wilcox-Tech.com>2019-10-24 02:20:33 -0500
commit4755175ad26eaff1765407bb01f8820f394f847b (patch)
tree9951bb91734a04e71f82d44284c74e56e8711f09 /tests/spec/validator_spec.rb
parent30b63f19fedde7b60bf99f3a68c0437a0c93b64e (diff)
downloadhorizon-4755175ad26eaff1765407bb01f8820f394f847b.tar.gz
horizon-4755175ad26eaff1765407bb01f8820f394f847b.tar.bz2
horizon-4755175ad26eaff1765407bb01f8820f394f847b.tar.xz
horizon-4755175ad26eaff1765407bb01f8820f394f847b.zip
hscript: Fully implement Timezone, add tests
Diffstat (limited to 'tests/spec/validator_spec.rb')
-rw-r--r--tests/spec/validator_spec.rb78
1 files changed, 53 insertions, 25 deletions
diff --git a/tests/spec/validator_spec.rb b/tests/spec/validator_spec.rb
index b07e383..457aa93 100644
--- a/tests/spec/validator_spec.rb
+++ b/tests/spec/validator_spec.rb
@@ -160,6 +160,44 @@ RSpec.describe 'HorizonScript validation', :type => :aruba do
run_validate
expect(last_command_started).to have_output(/error: .*rootpw.*/)
end
+ context "for 'language' key" do
+ # Runner.Validate.language
+ # Runner.Validate.language.Format
+ it "supports a simple language" do
+ use_fixture '0115-language-simple.installfile'
+ run_validate
+ expect(last_command_started).to have_output(PARSER_SUCCESS)
+ expect(last_command_started).to have_output(VALIDATOR_SUCCESS)
+ end
+ it "supports a language_territory value" do
+ use_fixture '0116-language-country.installfile'
+ run_validate
+ expect(last_command_started).to have_output(PARSER_SUCCESS)
+ expect(last_command_started).to have_output(VALIDATOR_SUCCESS)
+ end
+ it "supports the UTF-8 codeset" do
+ use_fixture '0117-language-codeset.installfile'
+ run_validate
+ expect(last_command_started).to have_output(PARSER_SUCCESS)
+ expect(last_command_started).to have_output(VALIDATOR_SUCCESS)
+ end
+ it "supports the special case C.UTF-8" do
+ use_fixture '0118-language-c-exception.installfile'
+ run_validate
+ expect(last_command_started).to have_output(PARSER_SUCCESS)
+ expect(last_command_started).to have_output(VALIDATOR_SUCCESS)
+ end
+ it "requires a valid language" do
+ use_fixture '0119-language-invalid.installfile'
+ run_validate
+ expect(last_command_started).to have_output(/error: .*language.*invalid/)
+ end
+ it "requires the UTF-8 codeset" do
+ use_fixture '0120-language-iso.installfile'
+ run_validate
+ expect(last_command_started).to have_output(/error: .*language.*codeset/)
+ end
+ end
context "for 'firmware' key" do
it "always supports 'false' value" do
use_fixture '0112-firmware-false.installfile'
@@ -186,43 +224,33 @@ RSpec.describe 'HorizonScript validation', :type => :aruba do
expect(last_command_started).to have_output(/error: .*firmware.*value/)
end
end
- context "for 'language' key" do
- # Runner.Validate.language
- # Runner.Validate.language.Format
- it "supports a simple language" do
- use_fixture '0115-language-simple.installfile'
+ context "for 'timezone' key" do
+ # Runner.Validate.timezone.
+ it "fails with an invalid value" do
+ use_fixture '0132-timezone-invalid.installfile'
run_validate
- expect(last_command_started).to have_output(PARSER_SUCCESS)
- expect(last_command_started).to have_output(VALIDATOR_SUCCESS)
+ expect(last_command_started).to have_output(/error: .*timezone.*invalid/)
end
- it "supports a language_territory value" do
- use_fixture '0116-language-country.installfile'
+ # Runner.Validate.timezone.
+ it "fails with a maliciously invalid value" do
+ use_fixture '0133-timezone-malicious.installfile'
run_validate
- expect(last_command_started).to have_output(PARSER_SUCCESS)
- expect(last_command_started).to have_output(VALIDATOR_SUCCESS)
+ expect(last_command_started).to have_output(/error: .*timezone.*invalid/)
end
- it "supports the UTF-8 codeset" do
- use_fixture '0117-language-codeset.installfile'
+ # Runner.Validate.timezone.zoneinfo.
+ it "succeeds with simple value" do
+ use_fixture '0131-timezone-basic.installfile'
run_validate
expect(last_command_started).to have_output(PARSER_SUCCESS)
expect(last_command_started).to have_output(VALIDATOR_SUCCESS)
end
- it "supports the special case C.UTF-8" do
- use_fixture '0118-language-c-exception.installfile'
+ # Runner.Validate.timezone.zoneinfo.
+ it "succeeds with Locality/Zone value" do
+ use_fixture '0134-timezone-subtz.installfile'
run_validate
expect(last_command_started).to have_output(PARSER_SUCCESS)
expect(last_command_started).to have_output(VALIDATOR_SUCCESS)
end
- it "requires a valid language" do
- use_fixture '0119-language-invalid.installfile'
- run_validate
- expect(last_command_started).to have_output(/error: .*language.*invalid/)
- end
- it "requires the UTF-8 codeset" do
- use_fixture '0120-language-iso.installfile'
- run_validate
- expect(last_command_started).to have_output(/error: .*language.*codeset/)
- end
end
context "for 'mount' key" do
# Runner.Validate.mount.