diff options
author | mihaibuzgau <mihaibuzgau@users.noreply.github.com> | 2019-10-24 14:38:54 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-10-24 14:38:54 +0300 |
commit | f78b81b829cb46dffe8fd93065d99d739f51cd46 (patch) | |
tree | 14325ebd9557118ca4d3215acbc57d050d54fbd6 /spec/unit | |
parent | e3edf941df7b81d6f2abc32505247e0482c85dec (diff) | |
parent | b2c153b6ff070d620d47c83265992f7226646ee8 (diff) | |
download | puppet-sshkeys_core-f78b81b829cb46dffe8fd93065d99d739f51cd46.tar.gz puppet-sshkeys_core-f78b81b829cb46dffe8fd93065d99d739f51cd46.tar.bz2 |
Merge pull request #20 from GabrielNagy/MODULES-9578/create-file-as-root
(MODULES-9578) Create ssh_authorized_key in root path
Diffstat (limited to 'spec/unit')
-rw-r--r-- | spec/unit/type/ssh_authorized_key_spec.rb | 24 |
1 files changed, 23 insertions, 1 deletions
diff --git a/spec/unit/type/ssh_authorized_key_spec.rb b/spec/unit/type/ssh_authorized_key_spec.rb index 866c688..457537c 100644 --- a/spec/unit/type/ssh_authorized_key_spec.rb +++ b/spec/unit/type/ssh_authorized_key_spec.rb @@ -17,7 +17,7 @@ describe Puppet::Type.type(:ssh_authorized_key), unless: Puppet.features.microso end describe 'when validating attributes' do - [:name, :provider].each do |param| + [:name, :provider, :drop_privileges].each do |param| it "has a #{param} parameter" do expect(described_class.attrtype(param)).to eq :param end @@ -56,6 +56,28 @@ describe Puppet::Type.type(:ssh_authorized_key), unless: Puppet.features.microso end end + describe 'for drop_privileges' do + it 'uses true as a default value' do + expect(described_class.new(name: 'whev', user: 'nobody')[:drop_privileges]).to eq true + end + + [true, :true, 'true', :yes, 'yes'].each do |value| + it "supports #{value} and returns a boolean true" do + expect(described_class.new(name: 'whev', user: 'nobody', drop_privileges: value)[:drop_privileges]).to eq true + end + end + + [false, :false, 'false', :no, 'no'].each do |value| + it "supports #{value} and returns a boolean false" do + expect(described_class.new(name: 'whev', user: 'nobody', drop_privileges: value)[:drop_privileges]).to eq false + end + end + + it 'raises an exception on something else' do + expect { described_class.new(name: 'whev', user: 'nobody', drop_privileges: 'nope') }.to raise_error(Puppet::Error, %r{Invalid value}) + end + end + describe 'for type' do [ :'ssh-dss', :dsa, |