aboutsummaryrefslogtreecommitdiff
path: root/spec/defines/ssh_authorized_key_spec.rb
diff options
context:
space:
mode:
authorSilvio Rhatto <rhatto@riseup.net>2016-03-19 10:17:30 -0300
committerSilvio Rhatto <rhatto@riseup.net>2016-03-19 10:17:30 -0300
commitff79bc6295e9f089285ccc26c04cc72893a8384f (patch)
tree1a84dad2d03bc3814305eeaedb4cfd8d8dc09f36 /spec/defines/ssh_authorized_key_spec.rb
parent9b1d0f06fee4b0c457d0154c4153415758c10425 (diff)
parent672b0985d1c2acfde58fecc4c635517522c86268 (diff)
downloadpuppet-sshd-ff79bc6295e9f089285ccc26c04cc72893a8384f.tar.gz
puppet-sshd-ff79bc6295e9f089285ccc26c04cc72893a8384f.tar.bz2
Merge branch 'master' of https://gitlab.com/shared-puppet-modules-group/sshd
Conflicts: README templates/sshd_config/CentOS.erb templates/sshd_config/CentOS_Final.erb templates/sshd_config/Debian_etch.erb templates/sshd_config/Debian_jessie.erb templates/sshd_config/Debian_sid.erb templates/sshd_config/Debian_squeeze.erb templates/sshd_config/Debian_wheezy.erb templates/sshd_config/Ubuntu_trusty.erb
Diffstat (limited to 'spec/defines/ssh_authorized_key_spec.rb')
-rw-r--r--spec/defines/ssh_authorized_key_spec.rb45
1 files changed, 45 insertions, 0 deletions
diff --git a/spec/defines/ssh_authorized_key_spec.rb b/spec/defines/ssh_authorized_key_spec.rb
new file mode 100644
index 0000000..c73a91c
--- /dev/null
+++ b/spec/defines/ssh_authorized_key_spec.rb
@@ -0,0 +1,45 @@
+require 'spec_helper'
+
+describe 'sshd::ssh_authorized_key' do
+
+ context 'manage authorized key' do
+ let(:title) { 'foo' }
+ let(:ssh_key) { 'some_secret_ssh_key' }
+
+ let(:params) {{
+ :key => ssh_key,
+ }}
+
+ it { should contain_ssh_authorized_key('foo').with({
+ 'ensure' => 'present',
+ 'type' => 'ssh-dss',
+ 'user' => 'foo',
+ 'target' => '/home/foo/.ssh/authorized_keys',
+ 'key' => ssh_key,
+ })
+ }
+ end
+ context 'manage authoried key with options' do
+ let(:title) { 'foo2' }
+ let(:ssh_key) { 'some_secret_ssh_key' }
+
+ let(:params) {{
+ :key => ssh_key,
+ :options => ['command="/usr/bin/date"',
+ 'no-pty','no-X11-forwarding','no-agent-forwarding',
+ 'no-port-forwarding']
+ }}
+
+ it { should contain_ssh_authorized_key('foo2').with({
+ 'ensure' => 'present',
+ 'type' => 'ssh-dss',
+ 'user' => 'foo2',
+ 'target' => '/home/foo2/.ssh/authorized_keys',
+ 'key' => ssh_key,
+ 'options' => ['command="/usr/bin/date"',
+ 'no-pty','no-X11-forwarding','no-agent-forwarding',
+ 'no-port-forwarding']
+ })
+ }
+ end
+end