diff options
Diffstat (limited to 'tests')
13 files changed, 141 insertions, 0 deletions
diff --git a/tests/fixtures/0062-netssid-simple-none.installfile b/tests/fixtures/0062-netssid-simple-none.installfile new file mode 100644 index 0000000..4894284 --- /dev/null +++ b/tests/fixtures/0062-netssid-simple-none.installfile @@ -0,0 +1,6 @@ +network false +hostname test.machine +pkginstall adelie-base +rootpw $6$gumtLGmHwOVIRpQR$2M9PUO24hy5mofzWWf9a.YLbzOgOlUby1g0hDj.wG67E2wrrvys59fq02PPdxBdbgkLZFtjfEx6MHZwMBamwu/ +mount /dev/sda1 / +netssid wlan0 "h" none diff --git a/tests/fixtures/0063-netssid-simple-wep.installfile b/tests/fixtures/0063-netssid-simple-wep.installfile new file mode 100644 index 0000000..dac79f3 --- /dev/null +++ b/tests/fixtures/0063-netssid-simple-wep.installfile @@ -0,0 +1,6 @@ +network false +hostname test.machine +pkginstall adelie-base +rootpw $6$gumtLGmHwOVIRpQR$2M9PUO24hy5mofzWWf9a.YLbzOgOlUby1g0hDj.wG67E2wrrvys59fq02PPdxBdbgkLZFtjfEx6MHZwMBamwu/ +mount /dev/sda1 / +netssid wlan0 "Hophop" wep omgitsarabbit diff --git a/tests/fixtures/0064-netssid-simple-wpa.installfile b/tests/fixtures/0064-netssid-simple-wpa.installfile new file mode 100644 index 0000000..c49c428 --- /dev/null +++ b/tests/fixtures/0064-netssid-simple-wpa.installfile @@ -0,0 +1,6 @@ +network false +hostname test.machine +pkginstall adelie-base +rootpw $6$gumtLGmHwOVIRpQR$2M9PUO24hy5mofzWWf9a.YLbzOgOlUby1g0hDj.wG67E2wrrvys59fq02PPdxBdbgkLZFtjfEx6MHZwMBamwu/ +mount /dev/sda1 / +netssid wlan0 "Fox5G" wpa shhsekrit diff --git a/tests/fixtures/0065-netssid-spaces-none.installfile b/tests/fixtures/0065-netssid-spaces-none.installfile new file mode 100644 index 0000000..b30af63 --- /dev/null +++ b/tests/fixtures/0065-netssid-spaces-none.installfile @@ -0,0 +1,6 @@ +network false +hostname test.machine +pkginstall adelie-base +rootpw $6$gumtLGmHwOVIRpQR$2M9PUO24hy5mofzWWf9a.YLbzOgOlUby1g0hDj.wG67E2wrrvys59fq02PPdxBdbgkLZFtjfEx6MHZwMBamwu/ +mount /dev/sda1 / +netssid wlan0 "MotoVAP M91729SC046V" none diff --git a/tests/fixtures/0066-netssid-spaces-wep.installfile b/tests/fixtures/0066-netssid-spaces-wep.installfile new file mode 100644 index 0000000..9d68a9c --- /dev/null +++ b/tests/fixtures/0066-netssid-spaces-wep.installfile @@ -0,0 +1,6 @@ +network false +hostname test.machine +pkginstall adelie-base +rootpw $6$gumtLGmHwOVIRpQR$2M9PUO24hy5mofzWWf9a.YLbzOgOlUby1g0hDj.wG67E2wrrvys59fq02PPdxBdbgkLZFtjfEx6MHZwMBamwu/ +mount /dev/sda1 / +netssid wlan0 "Wiehe Investigation Agency" wep with spaces diff --git a/tests/fixtures/0067-netssid-spaces-wpa.installfile b/tests/fixtures/0067-netssid-spaces-wpa.installfile new file mode 100644 index 0000000..946b5af --- /dev/null +++ b/tests/fixtures/0067-netssid-spaces-wpa.installfile @@ -0,0 +1,6 @@ +network false +hostname test.machine +pkginstall adelie-base +rootpw $6$gumtLGmHwOVIRpQR$2M9PUO24hy5mofzWWf9a.YLbzOgOlUby1g0hDj.wG67E2wrrvys59fq02PPdxBdbgkLZFtjfEx6MHZwMBamwu/ +mount /dev/sda1 / +netssid wlan0 "The New Fox 5G" wpa shh, sekrit! diff --git a/tests/fixtures/0068-netssid-invalid-iface.installfile b/tests/fixtures/0068-netssid-invalid-iface.installfile new file mode 100644 index 0000000..8b0a30a --- /dev/null +++ b/tests/fixtures/0068-netssid-invalid-iface.installfile @@ -0,0 +1,6 @@ +network false +hostname test.machine +pkginstall adelie-base +rootpw $6$gumtLGmHwOVIRpQR$2M9PUO24hy5mofzWWf9a.YLbzOgOlUby1g0hDj.wG67E2wrrvys59fq02PPdxBdbgkLZFtjfEx6MHZwMBamwu/ +mount /dev/sda1 / +netssid wlP20p36s15f10d16 "h" none diff --git a/tests/fixtures/0069-netssid-unquoted.installfile b/tests/fixtures/0069-netssid-unquoted.installfile new file mode 100644 index 0000000..227aecf --- /dev/null +++ b/tests/fixtures/0069-netssid-unquoted.installfile @@ -0,0 +1,6 @@ +network false +hostname test.machine +pkginstall adelie-base +rootpw $6$gumtLGmHwOVIRpQR$2M9PUO24hy5mofzWWf9a.YLbzOgOlUby1g0hDj.wG67E2wrrvys59fq02PPdxBdbgkLZFtjfEx6MHZwMBamwu/ +mount /dev/sda1 / +netssid wlan0 h none diff --git a/tests/fixtures/0070-netssid-syntax-error.installfile b/tests/fixtures/0070-netssid-syntax-error.installfile new file mode 100644 index 0000000..0f3c15b --- /dev/null +++ b/tests/fixtures/0070-netssid-syntax-error.installfile @@ -0,0 +1,6 @@ +network false +hostname test.machine +pkginstall adelie-base +rootpw $6$gumtLGmHwOVIRpQR$2M9PUO24hy5mofzWWf9a.YLbzOgOlUby1g0hDj.wG67E2wrrvys59fq02PPdxBdbgkLZFtjfEx6MHZwMBamwu/ +mount /dev/sda1 / +netssid wlan0 "h none diff --git a/tests/fixtures/0071-netssid-missing-pw.installfile b/tests/fixtures/0071-netssid-missing-pw.installfile new file mode 100644 index 0000000..4b0309d --- /dev/null +++ b/tests/fixtures/0071-netssid-missing-pw.installfile @@ -0,0 +1,6 @@ +network false +hostname test.machine +pkginstall adelie-base +rootpw $6$gumtLGmHwOVIRpQR$2M9PUO24hy5mofzWWf9a.YLbzOgOlUby1g0hDj.wG67E2wrrvys59fq02PPdxBdbgkLZFtjfEx6MHZwMBamwu/ +mount /dev/sda1 / +netssid wlan0 "h" wep diff --git a/tests/fixtures/0072-netssid-missing-ssid.installfile b/tests/fixtures/0072-netssid-missing-ssid.installfile new file mode 100644 index 0000000..9a6eabb --- /dev/null +++ b/tests/fixtures/0072-netssid-missing-ssid.installfile @@ -0,0 +1,6 @@ +network false +hostname test.machine +pkginstall adelie-base +rootpw $6$gumtLGmHwOVIRpQR$2M9PUO24hy5mofzWWf9a.YLbzOgOlUby1g0hDj.wG67E2wrrvys59fq02PPdxBdbgkLZFtjfEx6MHZwMBamwu/ +mount /dev/sda1 / +netssid wlan0 diff --git a/tests/fixtures/0073-netssid-invalid-type.installfile b/tests/fixtures/0073-netssid-invalid-type.installfile new file mode 100644 index 0000000..4734e3f --- /dev/null +++ b/tests/fixtures/0073-netssid-invalid-type.installfile @@ -0,0 +1,7 @@ +network false +hostname test.machine +pkginstall adelie-base +rootpw $6$gumtLGmHwOVIRpQR$2M9PUO24hy5mofzWWf9a.YLbzOgOlUby1g0hDj.wG67E2wrrvys59fq02PPdxBdbgkLZFtjfEx6MHZwMBamwu/ +mount /dev/sda1 / +# wap as typo for wpa +netssid wlan0 "h" wap hlang diff --git a/tests/spec/validator.rb b/tests/spec/validator.rb index 96cf572..fb17fa6 100644 --- a/tests/spec/validator.rb +++ b/tests/spec/validator.rb @@ -365,6 +365,74 @@ RSpec.describe 'HorizonScript Validation Utility', :type => :aruba do expect(last_command_started).to have_output(/error: .*netaddress.*addresses/) end end + context "for 'netssid' key" do + it "succeeds with simple SSID, no security" do + use_fixture '0062-netssid-simple-none.installfile' + run_validate + expect(last_command_started).to have_output(PARSER_SUCCESS) + expect(last_command_started).to have_output(VALIDATOR_SUCCESS) + end + it "succeeds with simple SSID, WEP security" do + use_fixture '0063-netssid-simple-wep.installfile' + run_validate + expect(last_command_started).to have_output(PARSER_SUCCESS) + expect(last_command_started).to have_output(VALIDATOR_SUCCESS) + end + it "succeeds with simple SSID, WPA security" do + use_fixture '0064-netssid-simple-wpa.installfile' + run_validate + expect(last_command_started).to have_output(PARSER_SUCCESS) + expect(last_command_started).to have_output(VALIDATOR_SUCCESS) + end + it "succeeds with complex SSID, no security" do + use_fixture '0065-netssid-spaces-none.installfile' + run_validate + expect(last_command_started).to have_output(PARSER_SUCCESS) + expect(last_command_started).to have_output(VALIDATOR_SUCCESS) + end + it "succeeds with complex SSID, WEP security" do + use_fixture '0066-netssid-spaces-wep.installfile' + run_validate + expect(last_command_started).to have_output(PARSER_SUCCESS) + expect(last_command_started).to have_output(VALIDATOR_SUCCESS) + end + it "succeeds with complex SSID, WPA security" do + use_fixture '0067-netssid-spaces-wpa.installfile' + run_validate + expect(last_command_started).to have_output(PARSER_SUCCESS) + expect(last_command_started).to have_output(VALIDATOR_SUCCESS) + end + it "fails with invalid interface name" do + use_fixture '0068-netssid-invalid-iface.installfile' + run_validate + expect(last_command_started).to have_output(/error: .*netssid.*interface/) + end + it "fails with raw / unquoted SSID" do + use_fixture '0069-netssid-unquoted.installfile' + run_validate + expect(last_command_started).to have_output(/error: .*netssid.*quote/) + end + it "fails with SSID without terminating quote" do + use_fixture '0070-netssid-syntax-error.installfile' + run_validate + expect(last_command_started).to have_output(/error: .*netssid.*unterminated/) + end + it "fails with missing passphrase" do + use_fixture '0071-netssid-missing-pw.installfile' + run_validate + expect(last_command_started).to have_output(/error: .*netssid.*expected/) + end + it "fails with missing SSID" do + use_fixture '0072-netssid-missing-ssid.installfile' + run_validate + expect(last_command_started).to have_output(/error: .*netssid.*expected/) + end + it "fails with invalid security type" do + use_fixture '0073-netssid-invalid-type.installfile' + run_validate + expect(last_command_started).to have_output(/error: .*netssid.*security/) + end + end context "for 'repository' key" do it "succeeds with basic repositories" do use_fixture '0055-repository-basic.installfile' |