Sfoglia il codice sorgente

Fix broken binaries due to mock and integration reinstatement

George S. Baugh 10 anni fa
parent
commit
bc815f6d82
5 ha cambiato i file con 13 aggiunte e 18 eliminazioni
  1. 1 0
      bin/testrail-bulk-mark-results
  2. 1 1
      bin/testrail-report
  3. 2 2
      lib/TestRail/Utils.pm
  4. 7 7
      t/TestRail-Utils.t
  5. 2 8
      t/testrail-runs.t

+ 1 - 0
bin/testrail-bulk-mark-results

@@ -76,6 +76,7 @@ use utf8;
 
 use TestRail::API;
 use TestRail::Utils;
+use TestRail::Utils::Results;
 
 use Getopt::Long;
 Getopt::Long::Configure('pass_through');

+ 1 - 1
bin/testrail-report

@@ -158,7 +158,7 @@ $opts{result_options} = {'version' => $opts{version}} if $opts{version};
 if ($opts{'mock'}) {
     require Test::LWP::UserAgent::TestRailMock;
     $opts{'browser'} = $Test::LWP::UserAgent::TestRailMock::mockObject;
-    $opts{'debug'} = 0;
+    $opts{'debug'} = 1;
 }
 
 my $tap;

+ 2 - 2
lib/TestRail/Utils.pm

@@ -228,8 +228,8 @@ sub getHandle {
     if ($opts->{'mock'}) {
         use lib 't/lib'; #Unit tests will always run from the main dir during make test
         require Test::LWP::UserAgent::TestRailMock;
-        $opts->{'browser'} = $Test::LWP::UserAgent::TestRailMock::mockObject;
-        $opts->{'debug'} = 0;
+        $tr->{'browser'} = $Test::LWP::UserAgent::TestRailMock::mockObject;
+        $tr->{'debug'} = 0;
     }
     return $tr;
 }

+ 7 - 7
t/TestRail-Utils.t

@@ -65,13 +65,13 @@ is(scalar(@files),2,"TAP correctly parsed into right number of bins");
 is(scalar(@files),7,"TAP correctly parsed into right number of bins");
 
 #Test getRunInformation
-my ($apiurl,$login,$pw) = ('http://testrail.local','teodesian@cpan.org','fake');
-my $debug = 1;
-my $browser = $Test::LWP::UserAgent::TestRailMock::mockObject;
-
-my $tr = TestRail::API->new($apiurl,$login,$pw,undef,1);
-$tr->{'browser'} = $browser;
-$tr->{'debug'} = 0;
+my $login_opts = {
+    'apiurl'   => 'http://testrail.local',
+    'user'     => 'teodesian@cpan.org',
+    'password' => 'fake',
+    'mock'     => 1
+};
+my $tr = TestRail::Utils::getHandle($login_opts);
 
 #Plan mode, no milestone
 my $opts = {

+ 2 - 8
t/testrail-runs.t

@@ -1,7 +1,7 @@
 use strict;
 use warnings;
 
-use Test::More 'tests' => 14;
+use Test::More 'tests' => 12;
 
 #check status filters
 my @args = ($^X,qw{bin/testrail-runs --apiurl http://testrail.local --user "test@fake.fake" --password "fake" -j "TestProject" --mock});
@@ -32,14 +32,8 @@ is($? >> 8, 0, "Exit code OK looking for runs with passes, which should fail to
 chomp $out;
 is($out,'',"Gets no runs correctly looking for passes");
 
-@args = ($^X,qw{bin/testrail-runs --apiurl http://testrail.local --user "test@fake.fake" --password "fake" -j "CRUSH ALL HUMANS" --mock --status passed});
-$out = `@args`;
-is($? >> 8, 0, "Exit code OK looking for runs with passes");
-chomp $out;
-like($out,qr/SEND T-1000 INFILTRATION UNITS BACK IN TIME$/,"Gets run correctly looking for passes");
-
 #TODO check configs for real next time
-@args = ($^X,qw{bin/testrail-runs --apiurl http://testrail.local --user "test@fake.fake" --password "fake" -j "TestProject" --mock --config testConfig});
+@args = ($^X,qw{bin/testrail-runs --apiurl http://testrail.local --user "test@fake.fake" --password "fake" -j "TestProject" --mock --config testConfig --config eee});
 $out = `@args`;
 is($? >> 8, 0, "Exit code OK looking for runs with passes");
 chomp $out;