xtests for local sudo connector
Robert 'phaylon' Sedlacek [Wed, 30 May 2012 19:48:56 +0000 (19:48 +0000)]
xt/lib/TestFindUser.pm [new file with mode: 0644]
xt/local-sudo.t [new file with mode: 0644]

diff --git a/xt/lib/TestFindUser.pm b/xt/lib/TestFindUser.pm
new file mode 100644 (file)
index 0000000..8f1133c
--- /dev/null
@@ -0,0 +1,6 @@
+package TestFindUser;
+use Moo;
+
+sub user { $< }
+
+1;
diff --git a/xt/local-sudo.t b/xt/local-sudo.t
new file mode 100644 (file)
index 0000000..cd0af39
--- /dev/null
@@ -0,0 +1,17 @@
+use strictures 1;
+use Test::More;
+use FindBin;
+
+use lib "$FindBin::Bin/lib";
+
+use Object::Remote;
+
+my $user = $ENV{TEST_SUDOUSER}
+    or plan skip_all => q{Requires TEST_SUDOUSER to be set};
+
+my $remote = TestFindUser->new::on($user . '@');
+my $remote_user = $remote->user;
+like $remote_user, qr/^\d+$/, 'returned an int';
+isnt $remote_user, $<, 'ran as different user';
+
+done_testing;