X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=xt%2Flocal-sudo.t;h=b7e28c05d94881528242ddff832a101644ac07b2;hb=993ff858dd2fafe40f9bfcc3cc31b479b70888d6;hp=cd0af39bfa3b0b656a05a2cee81c732872e0e2f9;hpb=985c21e3beb624071999c7d416aa0fd62fa5789d;p=scpubgit%2FObject-Remote.git diff --git a/xt/local-sudo.t b/xt/local-sudo.t index cd0af39..b7e28c0 100644 --- a/xt/local-sudo.t +++ b/xt/local-sudo.t @@ -1,17 +1,28 @@ +use IO::Prompter; # dies, utterly, if loaded after strictures, no idea why use strictures 1; use Test::More; -use FindBin; - -use lib "$FindBin::Bin/lib"; +use lib 'xt/lib'; use Object::Remote; +use Object::Remote::Connector::LocalSudo; + my $user = $ENV{TEST_SUDOUSER} or plan skip_all => q{Requires TEST_SUDOUSER to be set}; -my $remote = TestFindUser->new::on($user . '@'); +my $pw; + +my $connector = Object::Remote::Connector::LocalSudo->new( + password_callback => sub { + $pw ||= prompt 'Sudo password', -echo => '*'; + } +); + +my $remote = TestFindUser->new::on($connector->connect($user)); my $remote_user = $remote->user; like $remote_user, qr/^\d+$/, 'returned an int'; isnt $remote_user, $<, 'ran as different user'; +$remote->send_err; + done_testing;