You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@whimsical.apache.org by se...@apache.org on 2020/06/28 19:45:48 UTC
[whimsy] branch master updated: Tests for _svn_build_cmd
This is an automated email from the ASF dual-hosted git repository.
sebb pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/whimsy.git
The following commit(s) were added to refs/heads/master by this push:
new 848b05b Tests for _svn_build_cmd
848b05b is described below
commit 848b05bd4ec9218e73f0346fa6f198eabdca9d11
Author: Sebb <se...@apache.org>
AuthorDate: Sun Jun 28 20:45:40 2020 +0100
Tests for _svn_build_cmd
---
lib/spec/lib/svn_spec.rb | 47 +++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 47 insertions(+)
diff --git a/lib/spec/lib/svn_spec.rb b/lib/spec/lib/svn_spec.rb
index cad0cd3..f46df50 100644
--- a/lib/spec/lib/svn_spec.rb
+++ b/lib/spec/lib/svn_spec.rb
@@ -292,4 +292,51 @@ describe ASF::SVN do
end
end
+
+ describe "ASF::SVN._svn_build_cmd" do
+ it "_svn_build_cmd('help', 'path', {}) should include path" do
+ cmd, stdin = ASF::SVN._svn_build_cmd('help', 'path', {})
+ expect(stdin).to eq(nil)
+ expect(cmd).to eq(["svn", "help", "--non-interactive", "--", "path"])
+ end
+
+ it "_svn_build_cmd('help', 'path', {user: 'whimsy'}) should not include username" do
+ cmd, stdin = ASF::SVN._svn_build_cmd('help', 'path', {user: 'whimsy'})
+ expect(stdin).to eq(nil)
+ expect(cmd).to eq(["svn", "help", "--non-interactive", "--", "path"])
+ end
+
+ it "_svn_build_cmd('help', 'path', {user: 'whimsy', password: 'pass}) should include username" do
+ cmd, stdin = ASF::SVN._svn_build_cmd('help', 'path', {user: 'whimsy', password: 'pass'})
+ exp = ["svn", "help", "--non-interactive", ["--username", "whimsy", "--no-auth-cache"], "--", "path"]
+ if res = ASF::SVN.passwordStdinOK?
+ expect(stdin).to eq('pass')
+ expect(cmd-exp).to eq([["--password-from-stdin"]])
+ else
+ expect(stdin).to eq(nil)
+ expect(cmd-exp).to eq([["--password", "pass"]])
+ end
+ end
+
+ it "_svn_build_cmd('help', 'path', {user: 'whimsysvn'}) should include username" do
+ cmd, stdin = ASF::SVN._svn_build_cmd('help', 'path', {user: 'whimsysvn'})
+ expect(stdin).to eq(nil)
+ expect(cmd).to eq(["svn", "help", "--non-interactive", ["--username", "whimsysvn", "--no-auth-cache"], "--", "path"])
+ end
+
+ it "_svn_build_cmd('help', 'path', {user: 'whimsysvn', dryrun: false}) should include username" do
+ cmd, stdin = ASF::SVN._svn_build_cmd('help', 'path', {user: 'whimsysvn', dryrun: false})
+ expect(stdin).to eq(nil)
+ expect(cmd).to eq(["svn", "help", "--non-interactive", ["--username", "whimsysvn", "--no-auth-cache"], "--", "path"])
+ end
+ it "_svn_build_cmd('help', 'path', {user: 'whimsysvn', dryrun: true}) should not include username" do
+ cmd, stdin = ASF::SVN._svn_build_cmd('help', 'path', {user: 'whimsysvn', dryrun: true})
+ expect(stdin).to eq(nil)
+ expect(cmd).to eq(["svn", "help", "--non-interactive", "--", "path"])
+ end
+
+ it "_svn_build_cmd('help', 'path', {_error: true}) should raise error" do
+ expect { ASF::SVN._svn_build_cmd('help', 'path', {_error: true}) }.to raise_error(ArgumentError, "Following options not recognised: [:_error]")
+ end
+ end
end