summaryrefslogtreecommitdiff
path: root/spec/integration
diff options
context:
space:
mode:
authorJohn Keiser <jkeiser@opscode.com>2013-10-16 13:52:16 -0700
committerJohn Keiser <jkeiser@opscode.com>2013-10-16 13:52:16 -0700
commite92b71e3d04bcc9fd405a4e3e8978bf6ddd036e6 (patch)
tree484a423069a5edde2cfbf96c6363db4f30ea6438 /spec/integration
parent07eb295ab11f12c7744292348a663501b8b2dd97 (diff)
parent2ff649179d68cec8e10b5b9c1472336e0591a22f (diff)
downloadchef-e92b71e3d04bcc9fd405a4e3e8978bf6ddd036e6.tar.gz
Sign requests to download cookbook files in knife download
Diffstat (limited to 'spec/integration')
-rw-r--r--spec/integration/knife/download_spec.rb27
1 files changed, 27 insertions, 0 deletions
diff --git a/spec/integration/knife/download_spec.rb b/spec/integration/knife/download_spec.rb
index bb7dc17856..ce8df38bd8 100644
--- a/spec/integration/knife/download_spec.rb
+++ b/spec/integration/knife/download_spec.rb
@@ -968,4 +968,31 @@ EOM
end
end
end # with versioned cookbooks
+
+ when_the_chef_server 'has a cookbook' do
+ cookbook 'x', '1.0.0', { 'metadata.rb' => 'version "1.0.0"' }
+
+ when_the_repository 'is empty' do
+ it 'knife download /cookbooks/x signs all requests' do
+
+ # Check that BasicClient.request() always gets called with X-OPS-USERID
+ original_new = Chef::HTTP::BasicClient.method(:new)
+ Chef::HTTP::BasicClient.should_receive(:new) do |args|
+ new_result = original_new.call(*args)
+ original_request = new_result.method(:request)
+ new_result.should_receive(:request) do |method, url, body, headers, &response_handler|
+ headers['X-OPS-USERID'].should_not be_nil
+ original_request.call(method, url, body, headers, &response_handler)
+ end.at_least(:once)
+ new_result
+ end.at_least(:once)
+
+ knife('download /cookbooks/x').should_succeed <<EOM
+Created /cookbooks
+Created /cookbooks/x
+Created /cookbooks/x/metadata.rb
+EOM
+ end
+ end
+ end
end