[DRE-commits] [ruby-net-scp] 01/02: d/p/0002-disable-assert_scripted-so-that-test-does-not-fail-b.patch: Replace with an upstream commit.
Unit 193
unit193-guest at moszumanska.debian.org
Mon Jul 24 09:01:20 UTC 2017
This is an automated email from the git hooks/post-receive script.
unit193-guest pushed a commit to branch master
in repository ruby-net-scp.
commit fb1560642b7e73ccd64b53631e83a24e78dd2e2d
Author: Unit 193 <unit193 at ubuntu.com>
Date: Mon Jul 24 03:00:30 2017 -0400
d/p/0002-disable-assert_scripted-so-that-test-does-not-fail-b.patch: Replace with an upstream commit.
---
...ror-cases-to-raise-Net-SCP-Error-instead-.patch | 107 +++++++++++++++++++++
...ert_scripted-so-that-test-does-not-fail-b.patch | 43 ---------
debian/patches/series | 2 +-
3 files changed, 108 insertions(+), 44 deletions(-)
diff --git a/debian/patches/0002-Fix-some-error-cases-to-raise-Net-SCP-Error-instead-.patch b/debian/patches/0002-Fix-some-error-cases-to-raise-Net-SCP-Error-instead-.patch
new file mode 100644
index 0000000..bc1f296
--- /dev/null
+++ b/debian/patches/0002-Fix-some-error-cases-to-raise-Net-SCP-Error-instead-.patch
@@ -0,0 +1,107 @@
+From: chqr <choover at kayak.com>
+Date: Mon, 5 May 2014 20:17:48 -0400
+Subject: Fix some error cases to raise Net::SCP::Error instead of
+ RuntimeError, add tests
+
+---
+ lib/net/scp.rb | 2 +-
+ lib/net/scp/download.rb | 4 ++--
+ test/test_download.rb | 31 +++++++++++++++++++++++++++++++
+ test/test_upload.rb | 11 +++++++++++
+ 4 files changed, 45 insertions(+), 3 deletions(-)
+
+diff --git a/lib/net/scp.rb b/lib/net/scp.rb
+index 9a65025..785a3b4 100644
+--- a/lib/net/scp.rb
++++ b/lib/net/scp.rb
+@@ -395,7 +395,7 @@ module Net
+ def await_response_state(channel)
+ return if channel[:buffer].available == 0
+ c = channel[:buffer].read_byte
+- raise "#{c.chr}#{channel[:buffer].read}" if c != 0
++ raise Net::SCP::Error, "#{c.chr}#{channel[:buffer].read}" if c != 0
+ channel[:next], channel[:state] = nil, channel[:next]
+ send("#{channel[:state]}_state", channel)
+ end
+diff --git a/lib/net/scp/download.rb b/lib/net/scp/download.rb
+index 5ee35dd..6e66a79 100644
+--- a/lib/net/scp/download.rb
++++ b/lib/net/scp/download.rb
+@@ -129,7 +129,7 @@ module Net; class SCP
+ channel[:local] = File.join(channel[:local], directive[:name])
+
+ if File.exists?(channel[:local]) && !File.directory?(channel[:local])
+- raise "#{channel[:local]} already exists and is not a directory"
++ raise Net::SCP::Error, "#{channel[:local]} already exists and is not a directory"
+ elsif !File.exists?(channel[:local])
+ Dir.mkdir(channel[:local], directive[:mode] | 0700)
+ end
+@@ -162,4 +162,4 @@ module Net; class SCP
+ end
+ end
+
+-end; end
+\ No newline at end of file
++end; end
+diff --git a/test/test_download.rb b/test/test_download.rb
+index f3f9a14..1f2952a 100644
+--- a/test/test_download.rb
++++ b/test/test_download.rb
+@@ -158,6 +158,37 @@ class TestDownload < Net::SCP::TestCase
+ assert_raises(Net::SCP::Error) { scp.download!("/path/to/remote") }
+ end
+
++ def test_download_should_raise_error_if_gets_not_ok
++ prepare_file("/path/to/local.txt", "")
++
++ expect_scp_session "-f /path/to/remote.txt" do |channel|
++ channel.sends_ok
++ channel.gets_data "C0666 0 remote.txt\n"
++ channel.sends_ok
++ channel.gets_data "\1"
++ end
++
++ e = assert_raises(Net::SCP::Error) { scp.download!("/path/to/remote.txt", "/path/to/local.txt") }
++ assert_equal("\1", e.message)
++ end
++
++ def test_download_directory_should_raise_error_if_local_exists_and_is_not_directory
++ File.stubs(:exists?).with("/path/to/local").returns(true)
++ File.stubs(:exists?).with("/path/to/local/remote").returns(true)
++ File.stubs(:directory?).with("/path/to/local/remote").returns(false)
++
++ expect_scp_session "-f -r /path/to/remote" do |channel|
++ channel.sends_ok
++ channel.gets_data "D0755 0 remote\n"
++ channel.sends_ok
++ channel.gets_data "E\n"
++ channel.sends_ok
++ end
++
++ e = assert_raises(Net::SCP::Error) { scp.download!("/path/to/remote", "/path/to/local", :recursive => true) }
++ assert_match(/exists and is not a directory/, e.message)
++ end
++
+ def test_download_directory_should_create_directory_and_files_locally
+ file = nil
+ prepare_directory "/path/to/local" do |dir|
+diff --git a/test/test_upload.rb b/test/test_upload.rb
+index d565df0..02b4062 100644
+--- a/test/test_upload.rb
++++ b/test/test_upload.rb
+@@ -266,4 +266,15 @@ class TestUpload < Net::SCP::TestCase
+ story { |s| s.opens_channel(false) }
+ assert_scripted { scp.upload("/path/to/local.txt", "/path/to/remote.txt") }
+ end
++
++ def test_upload_should_raise_error_if_gets_not_ok
++ prepare_file("/path/to/local.txt", "")
++
++ expect_scp_session "-t /path/to/remote.txt" do |channel|
++ channel.gets_data "\1"
++ end
++
++ e = assert_raises(Net::SCP::Error) { scp.upload!("/path/to/local.txt", "/path/to/remote.txt") }
++ assert_equal("\1", e.message)
++ end
+ end
diff --git a/debian/patches/0002-disable-assert_scripted-so-that-test-does-not-fail-b.patch b/debian/patches/0002-disable-assert_scripted-so-that-test-does-not-fail-b.patch
deleted file mode 100644
index 0eae3ac..0000000
--- a/debian/patches/0002-disable-assert_scripted-so-that-test-does-not-fail-b.patch
+++ /dev/null
@@ -1,43 +0,0 @@
-From: Lucas Nussbaum <lucas at debian.org>
-Date: Sat, 23 Jul 2016 08:54:26 +0200
-Subject: disable assert_scripted so that test does not fail because of
- exception
-
-commit 982cbdc4d2294e479e370b97e695582d7e691643
-Author: Lucas Nussbaum <lucas.nussbaum at loria.fr>
-Date: Sat Jul 23 08:46:42 2016 +0200
-Forwarded: https://github.com/net-ssh/net-scp/pull/28
-
- Test should not fail because of exception raised
-
- Since commit 4b36d0c08fc55d45ca4025daf4bad5c8349efcb4 in net-ssh, this
- test fails. Since an exception is raised in the middle of the story, the
- last steps are not processed, and assert_scripted fails.
-
- Given an exception is raised in the middle of exception, it is expected
- that the story cannot finish completely.
----
- test/test_download.rb | 10 ++++------
- 1 file changed, 4 insertions(+), 6 deletions(-)
-
-diff --git a/test/test_download.rb b/test/test_download.rb
-index f3f9a14..1fa33a0 100644
---- a/test/test_download.rb
-+++ b/test/test_download.rb
-@@ -70,12 +70,10 @@ class TestDownload < Net::SCP::TestCase
- end
-
- error = nil
-- assert_scripted do
-- begin
-- scp.download!("/path/to/remote.txt")
-- rescue
-- error = $!
-- end
-+ begin
-+ scp.download!("/path/to/remote.txt")
-+ rescue
-+ error = $!
- end
- assert_equal Net::SCP::Error, error.class
- assert_equal "SCP did not finish successfully (1): File not found: /path/to/remote.txt\n", error.message
diff --git a/debian/patches/series b/debian/patches/series
index 1b9df44..9b25df6 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -1,2 +1,2 @@
disable-gem-in-tests.patch
-0002-disable-assert_scripted-so-that-test-does-not-fail-b.patch
+0002-Fix-some-error-cases-to-raise-Net-SCP-Error-instead-.patch
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-ruby-extras/ruby-net-scp.git
More information about the Pkg-ruby-extras-commits
mailing list