summaryrefslogtreecommitdiff
path: root/spec/defines/ssh_authorized_key_spec.rb
diff options
context:
space:
mode:
authorMicah <micah@leap.se>2016-05-24 10:19:22 -0400
committerMicah <micah@leap.se>2016-05-24 10:19:22 -0400
commit823e83dfb47af1d023f5e4ca46078bbc4df72006 (patch)
tree30f236bd3940e97d7f324f9e15b56532253feb52 /spec/defines/ssh_authorized_key_spec.rb
Squashed 'puppet/modules/sshd/' content from commit 76f4f87
git-subtree-dir: puppet/modules/sshd git-subtree-split: 76f4f872f81209a52df2205fd88b5619df58f003
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 00000000..c73a91cc
--- /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