[DRE-commits] [ruby-rest-client] 01/01: Add patches from Steve Langasek <steve.langasek at ubuntu.com> to fix network-dependent tests. Closes: 873576

Lucas Nussbaum lucas at moszumanska.debian.org
Tue Oct 31 10:25:52 UTC 2017


This is an automated email from the git hooks/post-receive script.

lucas pushed a commit to branch master
in repository ruby-rest-client.

commit 3e029d55a592602b94d5c82bf6a19c02ee22e25e
Author: Lucas Nussbaum <lucas at debian.org>
Date:   Tue Oct 31 11:19:59 2017 +0100

    Add patches from Steve Langasek <steve.langasek at ubuntu.com> to fix network-dependent tests. Closes: 873576
---
 debian/changelog                           |  9 ++++
 debian/patches/disable-network-tests.patch | 72 +++++++++++++++++++++++++++++-
 debian/patches/no-git-in-gemspec.patch     |  2 -
 debian/patches/proxy-proof-tests.patch     | 30 +++++++++++++
 debian/patches/series                      |  1 +
 5 files changed, 111 insertions(+), 3 deletions(-)

diff --git a/debian/changelog b/debian/changelog
index ab75e5d..1e1802b 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,12 @@
+ruby-rest-client (2.0.2-3) unstable; urgency=medium
+
+  * Add patches from Steve Langasek <steve.langasek at ubuntu.com> to fix
+    network-dependent tests. Closes: 873576
+    + proxy-proof-tests.patch
+    + disable-network-tests.patch
+
+ -- Lucas Nussbaum <lucas at debian.org>  Tue, 31 Oct 2017 11:21:55 +0100
+
 ruby-rest-client (2.0.2-2) unstable; urgency=medium
 
   [ Antonio Terceiro ]
diff --git a/debian/patches/disable-network-tests.patch b/debian/patches/disable-network-tests.patch
index 3b5e1dc..cf23a7e 100644
--- a/debian/patches/disable-network-tests.patch
+++ b/debian/patches/disable-network-tests.patch
@@ -1,6 +1,8 @@
 From: Matthias Klose <doko at ubuntu.com>
-Last-Update: 2016-03-16
+From: Steve Langasek <steve.langasek at ubuntu.com>
+Last-Update: 2017-08-29
 Bug-Debian: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=818459
+Bug-Debian: https://bugs.debian.org/873576
 Forwarded: no
 
 --- a/spec/integration/request_spec.rb
@@ -103,3 +105,71 @@ Forwarded: no
    end
  
    describe "timeouts" do
+@@ -113,15 +24,6 @@ describe RestClient::Request do
+         raise_error(RestClient::Exceptions::OpenTimeout))
+     end
+ 
+-    it "raises ReadTimeout when it hits a read timeout via :read_timeout" do
+-      request = RestClient::Request.new(
+-        :method => :get,
+-        :url => 'https://www.mozilla.org',
+-        :read_timeout => 1e-10,
+-      )
+-      expect { request.execute }.to(
+-        raise_error(RestClient::Exceptions::ReadTimeout))
+-    end
+   end
+ 
+ end
+--- a/spec/integration/httpbin_spec.rb
++++ b/spec/integration/httpbin_spec.rb
+@@ -40,48 +40,6 @@ describe RestClient::Request do
+   end
+ 
+   describe '.execute' do
+-    it 'sends a user agent' do
+-      data = execute_httpbin_json('user-agent', method: :get)
+-      expect(data['user-agent']).to match(/rest-client/)
+-    end
+-
+-    it 'receives cookies on 302' do
+-      expect {
+-        execute_httpbin('cookies/set?foo=bar', method: :get, max_redirects: 0)
+-      }.to raise_error(RestClient::Found) { |ex|
+-        expect(ex.http_code).to eq 302
+-        expect(ex.response.cookies['foo']).to eq 'bar'
+-      }
+-    end
+-
+-    it 'passes along cookies through 302' do
+-      data = execute_httpbin_json('cookies/set?foo=bar', method: :get)
+-      expect(data).to have_key('cookies')
+-      expect(data['cookies']['foo']).to eq 'bar'
+-    end
+-
+-    it 'handles quote wrapped cookies' do
+-      expect {
+-        execute_httpbin('cookies/set?foo=' + CGI.escape('"bar:baz"'),
+-                        method: :get, max_redirects: 0)
+-      }.to raise_error(RestClient::Found) { |ex|
+-        expect(ex.http_code).to eq 302
+-        expect(ex.response.cookies['foo']).to eq '"bar:baz"'
+-      }
+-    end
+-
+-    it 'sends basic auth' do
+-      user = 'user'
+-      pass = 'pass'
+-
+-      data = execute_httpbin_json("basic-auth/#{user}/#{pass}", method: :get, user: user, password: pass)
+-      expect(data).to eq({'authenticated' => true, 'user' => user})
+-
+-      expect {
+-        execute_httpbin_json("basic-auth/#{user}/#{pass}", method: :get, user: user, password: 'badpass')
+-      }.to raise_error(RestClient::Unauthorized) { |ex|
+-        expect(ex.http_code).to eq 401
+-      }
+-    end
++    # all removed; accessing the network
+   end
+ end
diff --git a/debian/patches/no-git-in-gemspec.patch b/debian/patches/no-git-in-gemspec.patch
index b3f8a20..07687ba 100644
--- a/debian/patches/no-git-in-gemspec.patch
+++ b/debian/patches/no-git-in-gemspec.patch
@@ -7,8 +7,6 @@ Replace calls to 'git' in gemspec by explicit lists of files
  rest-client.gemspec | 4 ++--
  1 file changed, 2 insertions(+), 2 deletions(-)
 
-diff --git a/rest-client.gemspec b/rest-client.gemspec
-index e780a12..2f8f32e 100644
 --- a/rest-client.gemspec
 +++ b/rest-client.gemspec
 @@ -11,8 +11,8 @@ Gem::Specification.new do |s|
diff --git a/debian/patches/proxy-proof-tests.patch b/debian/patches/proxy-proof-tests.patch
new file mode 100644
index 0000000..aa4862e
--- /dev/null
+++ b/debian/patches/proxy-proof-tests.patch
@@ -0,0 +1,30 @@
+Description: Fix tests to pass cleanly when http_proxy is set in the env
+ An autopkgtest environment may have a global proxy set for access to the
+ Internet.  Our tests should not fail if this is the case.  Mock the
+ environment so that we're not inadvertently testing the wrong thing.
+Author: Steve Langasek <steve.langasek at ubuntu.com>
+
+Index: ruby-rest-client-2.0.2/spec/unit/request_spec.rb
+===================================================================
+--- ruby-rest-client-2.0.2.orig/spec/unit/request_spec.rb
++++ ruby-rest-client-2.0.2/spec/unit/request_spec.rb
+@@ -579,6 +579,9 @@
+     end
+ 
+     it "creates a non-proxy class if a proxy url is not given" do
++      allow(ENV).to receive(:[]).with("HTTP_PROXY").and_return(nil)
++      allow(ENV).to receive(:[]).with("http_proxy").and_return(nil)
++      allow(ENV).to receive(:[]).with("NETRC").and_return(nil)
+       expect(@proxy_req.net_http_object('host', 80).proxy?).to be_falsey
+     end
+ 
+@@ -592,6 +595,9 @@
+     end
+ 
+     it "sets proxy on a per-request basis" do
++      allow(ENV).to receive(:[]).with("HTTP_PROXY").and_return(nil)
++      allow(ENV).to receive(:[]).with("http_proxy").and_return(nil)
++      allow(ENV).to receive(:[]).with("NETRC").and_return(nil)
+       expect(@proxy_req.net_http_object('some', 80).proxy?).to be_falsey
+ 
+       req = RestClient::Request.new(:method => :put, :url => 'http://some/resource', :payload => 'payload', :proxy => 'http://example.com')
diff --git a/debian/patches/series b/debian/patches/series
index 96afbca..512ee13 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -1,2 +1,3 @@
 disable-network-tests.patch
 no-git-in-gemspec.patch
+proxy-proof-tests.patch

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-ruby-extras/ruby-rest-client.git



More information about the Pkg-ruby-extras-commits mailing list