summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorA. Wilcox <AWilcox@Wilcox-Tech.com>2019-10-14 07:36:33 -0500
committerA. Wilcox <AWilcox@Wilcox-Tech.com>2019-10-14 07:36:33 -0500
commit37005da8fbecc64c2942ac03f9189b219be69104 (patch)
treef1c6b98c03d00a6ee7a07fc2626c60969281f894 /tests
parent5593f1f14f62e9474a0f14d0b863d1331468c522 (diff)
downloadhorizon-37005da8fbecc64c2942ac03f9189b219be69104.tar.gz
horizon-37005da8fbecc64c2942ac03f9189b219be69104.tar.bz2
horizon-37005da8fbecc64c2942ac03f9189b219be69104.tar.xz
horizon-37005da8fbecc64c2942ac03f9189b219be69104.zip
hscript: Add NetSSID parsing and tests
Diffstat (limited to 'tests')
-rw-r--r--tests/fixtures/0062-netssid-simple-none.installfile6
-rw-r--r--tests/fixtures/0063-netssid-simple-wep.installfile6
-rw-r--r--tests/fixtures/0064-netssid-simple-wpa.installfile6
-rw-r--r--tests/fixtures/0065-netssid-spaces-none.installfile6
-rw-r--r--tests/fixtures/0066-netssid-spaces-wep.installfile6
-rw-r--r--tests/fixtures/0067-netssid-spaces-wpa.installfile6
-rw-r--r--tests/fixtures/0068-netssid-invalid-iface.installfile6
-rw-r--r--tests/fixtures/0069-netssid-unquoted.installfile6
-rw-r--r--tests/fixtures/0070-netssid-syntax-error.installfile6
-rw-r--r--tests/fixtures/0071-netssid-missing-pw.installfile6
-rw-r--r--tests/fixtures/0072-netssid-missing-ssid.installfile6
-rw-r--r--tests/fixtures/0073-netssid-invalid-type.installfile7
-rw-r--r--tests/spec/validator.rb68
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'