summaryrefslogtreecommitdiff
path: root/spec/functional
diff options
context:
space:
mode:
authorThom May <thom@chef.io>2017-03-16 17:43:45 +0000
committerThom May <thom@chef.io>2017-03-16 20:23:40 +0000
commit6a16e21869e430352a6d4955843b79e3b6a63ff0 (patch)
tree15752ad125f2b6c92d57998896ffc9b3cf6c168a /spec/functional
parent1f23881a95d1dfa63158c7c35d3f8723df97a758 (diff)
downloadchef-6a16e21869e430352a6d4955843b79e3b6a63ff0.tar.gz
Remove Chef::RESTtm/remove_chef_rest
Signed-off-by: Thom May <thom@chef.io>
Diffstat (limited to 'spec/functional')
-rw-r--r--spec/functional/rest_spec.rb95
1 files changed, 0 insertions, 95 deletions
diff --git a/spec/functional/rest_spec.rb b/spec/functional/rest_spec.rb
deleted file mode 100644
index 14e76087c4..0000000000
--- a/spec/functional/rest_spec.rb
+++ /dev/null
@@ -1,95 +0,0 @@
-#
-# Author:: Lamont Granquist (<lamont@chef.io>)
-# Copyright:: Copyright 2014-2016, Chef Software, Inc.
-# License:: Apache License, Version 2.0
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-#
-
-require "spec_helper"
-require "tiny_server"
-require "support/shared/functional/http"
-
-describe Chef::REST do
- include ChefHTTPShared
-
- let(:http_client) { described_class.new(source) }
- let(:http_client_disable_gzip) { described_class.new(source, Chef::Config[:node_name], Chef::Config[:client_key], { :disable_gzip => true } ) }
-
- shared_examples_for "downloads requests correctly" do
- it "successfully downloads a streaming request" do
- tempfile = http_client.streaming_request(source, {})
- tempfile.close
- expect(Digest::MD5.hexdigest(binread(tempfile.path))).to eq(Digest::MD5.hexdigest(expected_content))
- end
-
- it "successfully downloads a GET request" do
- tempfile = http_client.get(source, {})
- tempfile.close
- expect(Digest::MD5.hexdigest(binread(tempfile.path))).to eq(Digest::MD5.hexdigest(expected_content))
- end
- end
-
- shared_examples_for "validates content length and throws an exception" do
- it "fails validation on a streaming download" do
- expect { http_client.streaming_request(source, {}) }.to raise_error(Chef::Exceptions::ContentLengthMismatch)
- end
-
- it "fails validation on a GET request" do
- expect { http_client.get(source, {}) }.to raise_error(Chef::Exceptions::ContentLengthMismatch)
- end
- end
-
- shared_examples_for "an endpoint that 403s" do
- it "fails with a Net::HTTPServerException on a streaming download" do
- expect { http_client.streaming_request(source, {}) }.to raise_error(Net::HTTPServerException)
- end
-
- it "fails with a Net::HTTPServerException on a GET request" do
- expect { http_client.get(source, {}) }.to raise_error(Net::HTTPServerException)
- end
- end
-
- # see CHEF-5100
- shared_examples_for "a 403 after a successful request when reusing the request object" do
- it "fails with a Net::HTTPServerException on a streaming download" do
- tempfile = http_client.streaming_request(source, {})
- tempfile.close
- expect(Digest::MD5.hexdigest(binread(tempfile.path))).to eq(Digest::MD5.hexdigest(expected_content))
- expect { http_client.streaming_request(source2, {}) }.to raise_error(Net::HTTPServerException)
- end
-
- it "fails with a Net::HTTPServerException on a GET request" do
- tempfile = http_client.get(source, {})
- tempfile.close
- expect(Digest::MD5.hexdigest(binread(tempfile.path))).to eq(Digest::MD5.hexdigest(expected_content))
- expect { http_client.get(source2, {}) }.to raise_error(Net::HTTPServerException)
- end
- end
-
- before do
- Chef::Config[:node_name] = "webmonkey.example.com"
- Chef::Config[:client_key] = CHEF_SPEC_DATA + "/ssl/private_key.pem"
- Chef::Config[:treat_deprecation_warnings_as_errors] = false
- end
-
- before(:each) do
- start_tiny_server
- end
-
- after(:each) do
- stop_tiny_server
- end
-
- it_behaves_like "downloading all the things"
-end