From: Robert 'phaylon' Sedlacek Date: Fri, 15 Jun 2012 01:55:27 +0000 (+0000) Subject: apt-get tests for Packages::Apt probe X-Git-Tag: v0.001_001~45 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=f25e8c9fc4232f051b3b96c52004c0086f6eca70;p=scpubgit%2FSystem-Introspector.git apt-get tests for Packages::Apt probe --- diff --git a/t/bin/apt-get b/t/bin/apt-get new file mode 100755 index 0000000..045b689 --- /dev/null +++ b/t/bin/apt-get @@ -0,0 +1,13 @@ +#!/usr/bin/env perl +use strict; +use warnings; + +if (grep { $_ eq 'upgrade' } @ARGV) { + printf "%s %s (%s)\n", @$_ for + ['Inst', 'foo', 'some foo info'], + ['Somethingelse', 'bar', 'some bar info'], + ['Remv', 'baz', 'some baz info']; +} +elsif (grep { $_ eq 'update' } @ARGV) { + print "OK\n"; +} diff --git a/t/packages-apt.t b/t/packages-apt.t index c9c1300..63b8b67 100644 --- a/t/packages-apt.t +++ b/t/packages-apt.t @@ -1,5 +1,6 @@ use strictures 1; use Test::More; +use FindBin; use System::Introspector::Probe::Packages::Apt; @@ -14,4 +15,21 @@ ok( 'versions', ); +do { + local $ENV{PATH} = join ':', "$FindBin::Bin/bin", $ENV{PATH}; + my $probe = System::Introspector::Probe::Packages::Apt->new( + apt_update => 1, + apt_update_after => 0, + ); + my $data = $probe->gather; + is_deeply $data->{upgradable}, { + actions => { + inst => { foo => '(some foo info)' }, + remv => { baz => '(some baz info)' }, + }, + }, 'upgradable packages'; + ok $data->{update}{last}, 'has last update time'; + ok $data->{update}{run}, 'has apt run state'; +}; + done_testing;