Skip to content
This repository has been archived by the owner on Aug 6, 2023. It is now read-only.

Commit

Permalink
Encodes local and remote passwords
Browse files Browse the repository at this point in the history
  • Loading branch information
fcoury committed Aug 3, 2011
1 parent e0050f3 commit afc6515
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 0 deletions.
13 changes: 13 additions & 0 deletions lib/webbynode/taps.rb
@@ -1,5 +1,6 @@
require 'taps/operation'
require 'taps/cli'
require 'cgi'

module Webbynode
class Taps
Expand Down Expand Up @@ -85,4 +86,16 @@ def execute(action, options)
:remote_url => remote_url)
end
end
end

class TapsError < StandardError; end

class Taps::Config
def self.puts(error)
@error = error
end

def self.exit(num)
raise TapsError, @error
end
end
16 changes: 16 additions & 0 deletions spec/webbynode/taps_spec.rb
Expand Up @@ -72,6 +72,22 @@
:remote_ip => "1.1.2.2"
end

it "encodes the local and remote password" do
subject.stub(:password).and_return("P@ssw=rd")

taps_cli = double('taps')
::Taps::Cli.stub(:new).and_return(taps_cli)

taps_cli.should_receive(:clientxfer).with(:pull,
:database_url => "mysql://local_user:P%40ssw0rd@localhost/local_db",
:remote_url => "http://user:P%40ssw%3Drd@1.1.2.2:5000")

subject.pull :user => "local_user",
:password => "P@ssw0rd",
:database => "local_db",
:remote_ip => "1.1.2.2"
end

it "raises an error if pull fails" do
pending "find a better way to detect errors"
io.should_receive(:execute).and_return(1)
Expand Down

0 comments on commit afc6515

Please sign in to comment.