summaryrefslogtreecommitdiff
path: root/tests/spec
diff options
context:
space:
mode:
authorA. Wilcox <AWilcox@Wilcox-Tech.com>2019-10-18 23:18:12 -0500
committerA. Wilcox <AWilcox@Wilcox-Tech.com>2019-10-18 23:18:12 -0500
commitda01034909eba11be184cedb408f34732a33c4cd (patch)
treebc75474a59515f33ada34377c2e12e92bfd5e048 /tests/spec
parent72ca6added88259f9b456810bdd7300c2037b23c (diff)
downloadhorizon-da01034909eba11be184cedb408f34732a33c4cd.tar.gz
horizon-da01034909eba11be184cedb408f34732a33c4cd.tar.bz2
horizon-da01034909eba11be184cedb408f34732a33c4cd.tar.xz
horizon-da01034909eba11be184cedb408f34732a33c4cd.zip
hscript: Implement username validity check and UserAlias code; add tests
Diffstat (limited to 'tests/spec')
-rw-r--r--tests/spec/validator.rb32
1 files changed, 32 insertions, 0 deletions
diff --git a/tests/spec/validator.rb b/tests/spec/validator.rb
index 2fa9c89..7fd8356 100644
--- a/tests/spec/validator.rb
+++ b/tests/spec/validator.rb
@@ -535,6 +535,38 @@ RSpec.describe 'HorizonScript validation', :type => :aruba do
run_validate
expect(last_command_started).to have_output(/error: .*username.*too many/)
end
+ it "fails with an invalid username" do
+ use_fixture '0086-username-invalid.installfile'
+ run_validate
+ expect(last_command_started).to have_output(/error: .*username.*invalid/)
+ end
+ end
+ context "'useralias'" do
+ # Runner.Validate.useralias.
+ it "succeeds with usernames with aliases" do
+ use_fixture '0087-useralias-basic.installfile'
+ run_validate
+ expect(last_command_started).to have_output(PARSER_SUCCESS)
+ expect(last_command_started).to have_output(VALIDATOR_SUCCESS)
+ end
+ # Runner.Validate.useralias.Validity.
+ it "requires an alias to be provided" do
+ use_fixture '0088-useralias-without-alias.installfile'
+ run_validate
+ expect(last_command_started).to have_output(/error: .*useralias.*required/)
+ end
+ # Runner.Validate.useralias.Name.
+ it "fails with a username that wasn't given" do
+ use_fixture '0089-useralias-unknown-name.installfile'
+ run_validate
+ expect(last_command_started).to have_output(/error: .*useralias.*name/)
+ end
+ # Runner.Validate.useralias.Unique.
+ it "fails with a duplicated alias" do
+ use_fixture '0090-useralias-duplicate.installfile'
+ run_validate
+ expect(last_command_started).to have_output(/error: .*duplicate.*useralias/)
+ end
end
end
context "package specifications" do