- initial tests for upload_payloads function
- test that files are uploaded when specified
- verify validation of combination of params.

Reviewed-by: Jeff McCune

Signed-off-by: Dan Bode <[email protected]>
---
 spec/unit/puppet/cloudpack_spec.rb |   41 ++++++++++++++++++++++++++++++++++++
 1 files changed, 41 insertions(+), 0 deletions(-)

diff --git a/spec/unit/puppet/cloudpack_spec.rb 
b/spec/unit/puppet/cloudpack_spec.rb
index 5cd4d3c..57330e1 100644
--- a/spec/unit/puppet/cloudpack_spec.rb
+++ b/spec/unit/puppet/cloudpack_spec.rb
@@ -130,6 +130,47 @@ describe Puppet::CloudPack do
           expect { subject.ssh_connect('server', 'root', @keyfile.path) 
}.should raise_error
         end
       end
+      describe '#upload_payloads' do
+        it 'should not upload anything if nothing is specifed to upload' do
+          @scp_mock.expects(:upload).never
+          @result = subject.upload_payloads(
+            @scp_mock,
+            {}
+          )
+        end
+        it 'should install answer file when specified' do
+          @scp_mock.expects(:upload).with('foo', "/tmp/puppet.answers")
+          @result = subject.upload_payloads(
+            @scp_mock,
+            {:installer_answers => 'foo', :tmp_dir => '/tmp'}
+          )
+        end
+        it 'should install installer_payload when specified' do
+          @scp_mock.expects(:upload).with('foo', "/tmp/puppet.tar.gz")
+          @result = subject.upload_payloads(
+            @scp_mock,
+            {:installer_payload => 'foo', :tmp_dir => '/tmp'}
+          )
+        end
+        it 'should require installer payload when install-script is 
puppet-enterprise' do
+          expect do
+            subject.upload_payloads(
+              @scp_mock,
+              :install_script => 'puppet-enterprise',
+              :installer_answers => 'foo'
+            )
+          end.should raise_error Exception, /Must specify installer payload/
+        end
+        it 'should require installer answers when install-script is 
puppet-enterprise' do
+          expect do
+            subject.upload_payloads(
+              @scp_mock,
+              :install_script => 'puppet-enterprise',
+              :installer_payload => 'foo'
+            )
+          end.should raise_error Exception, /Must specify .*? answers file/
+        end
+      end
     end
     describe '#terminate' do
       describe 'with valid arguments' do
-- 
1.7.5.4

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Developers" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/puppet-dev?hl=en.

Reply via email to