From ed351160f94bfff12fadbceb44a2f85604dfb957 Mon Sep 17 00:00:00 2001 From: "A. Wilcox" Date: Mon, 4 Nov 2019 20:09:34 -0600 Subject: tests: More validity tests for keymap and language --- tests/fixtures/0198-keymap-invalid.installfile | 6 ++++++ tests/fixtures/0199-language-invalid2.installfile | 6 ++++++ tests/spec/validator_spec.rb | 10 ++++++++++ 3 files changed, 22 insertions(+) create mode 100644 tests/fixtures/0198-keymap-invalid.installfile create mode 100644 tests/fixtures/0199-language-invalid2.installfile (limited to 'tests') diff --git a/tests/fixtures/0198-keymap-invalid.installfile b/tests/fixtures/0198-keymap-invalid.installfile new file mode 100644 index 0000000..2d330aa --- /dev/null +++ b/tests/fixtures/0198-keymap-invalid.installfile @@ -0,0 +1,6 @@ +network false +hostname test.machine +pkginstall adelie-base +rootpw $6$gumtLGmHwOVIRpQR$2M9PUO24hy5mofzWWf9a.YLbzOgOlUby1g0hDj.wG67E2wrrvys59fq02PPdxBdbgkLZFtjfEx6MHZwMBamwu/ +mount /dev/sda1 / +keymap klingon diff --git a/tests/fixtures/0199-language-invalid2.installfile b/tests/fixtures/0199-language-invalid2.installfile new file mode 100644 index 0000000..ee83679 --- /dev/null +++ b/tests/fixtures/0199-language-invalid2.installfile @@ -0,0 +1,6 @@ +network false +hostname test.machine +pkginstall adelie-base +rootpw $6$gumtLGmHwOVIRpQR$2M9PUO24hy5mofzWWf9a.YLbzOgOlUby1g0hDj.wG67E2wrrvys59fq02PPdxBdbgkLZFtjfEx6MHZwMBamwu/ +mount /dev/sda1 / +language zz diff --git a/tests/spec/validator_spec.rb b/tests/spec/validator_spec.rb index a9c5fd9..e950a97 100644 --- a/tests/spec/validator_spec.rb +++ b/tests/spec/validator_spec.rb @@ -197,6 +197,11 @@ RSpec.describe 'HorizonScript validation', :type => :aruba do run_validate expect(last_command_started).to have_output(/error: .*language.*codeset/) end + it "requires a valid two-char language" do + use_fixture '0199-language-invalid2.installfile' + run_validate + expect(last_command_started).to have_output(/error: .*language.*invalid/) + end end context "for 'nameserver' key" do it "succeeds with IPv4 and IPv6 addresses" do @@ -964,6 +969,11 @@ RSpec.describe 'HorizonScript validation', :type => :aruba do expect(last_command_started).to have_output(PARSER_SUCCESS) expect(last_command_started).to have_output(VALIDATOR_SUCCESS) end + it "fails with an invalid value" do + use_fixture '0198-keymap-invalid.installfile' + run_validate + expect(last_command_started).to have_output(/error: .*keymap.*invalid/) + end end end context "unique keys" do -- cgit v1.2.3-60-g2f50