From a0e961674b96c070e0a32bce3f224a1512aa128d Mon Sep 17 00:00:00 2001 From: Tomas Barton Date: Sun, 2 Feb 2014 17:48:24 +0100 Subject: tests for ssh authorized key --- spec/defines/ssh_authorized_key_spec.rb | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 spec/defines/ssh_authorized_key_spec.rb (limited to 'spec/defines/ssh_authorized_key_spec.rb') diff --git a/spec/defines/ssh_authorized_key_spec.rb b/spec/defines/ssh_authorized_key_spec.rb new file mode 100644 index 0000000..a554d9d --- /dev/null +++ b/spec/defines/ssh_authorized_key_spec.rb @@ -0,0 +1,22 @@ +require 'spec_helper' + +describe 'sshd::ssh_authorized_key' do + + context 'add 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 +end -- cgit v1.2.3 From 15a1a734627e76e9294886a47ce70578fe8436c7 Mon Sep 17 00:00:00 2001 From: mh Date: Wed, 5 Feb 2014 23:17:36 +0100 Subject: wording --- spec/defines/ssh_authorized_key_spec.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'spec/defines/ssh_authorized_key_spec.rb') diff --git a/spec/defines/ssh_authorized_key_spec.rb b/spec/defines/ssh_authorized_key_spec.rb index a554d9d..0cc4eb8 100644 --- a/spec/defines/ssh_authorized_key_spec.rb +++ b/spec/defines/ssh_authorized_key_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' describe 'sshd::ssh_authorized_key' do - context 'add authorized key' do + context 'manage authorized key' do let(:title) { 'foo' } let(:ssh_key) { 'some_secret_ssh_key' } -- cgit v1.2.3 From 253e4f1ceddb8666281c207bb41af1e8a167ee0d Mon Sep 17 00:00:00 2001 From: mh Date: Wed, 5 Feb 2014 23:21:36 +0100 Subject: add test for options --- spec/defines/ssh_authorized_key_spec.rb | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) (limited to 'spec/defines/ssh_authorized_key_spec.rb') diff --git a/spec/defines/ssh_authorized_key_spec.rb b/spec/defines/ssh_authorized_key_spec.rb index 0cc4eb8..c73a91c 100644 --- a/spec/defines/ssh_authorized_key_spec.rb +++ b/spec/defines/ssh_authorized_key_spec.rb @@ -19,4 +19,27 @@ describe 'sshd::ssh_authorized_key' do }) } 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 -- cgit v1.2.3