Change FAILED flag to ERROR in API
git-svn-id: svn://10.0.0.236/trunk@247847 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
parent
0045a0a9cf
commit
485af8ac67
@ -124,13 +124,13 @@ sub lookup_name_by_id {
|
||||
|
||||
my $result = defined $build ? $build->name : '';
|
||||
|
||||
# Result is build name string or empty string if failed
|
||||
# Result is build name string or empty string if ERROR
|
||||
return $result;
|
||||
}
|
||||
|
||||
# DEPRECATED use Build::check_build($name, $product) instead
|
||||
sub lookup_id_by_name {
|
||||
return { FAILED => 1, message => 'This method is considered harmful and has been depricated. Please use Build::check_build instead'};
|
||||
return { ERROR => 1, message => 'This method is considered harmful and has been depricated. Please use Build::check_build instead'};
|
||||
}
|
||||
|
||||
1;
|
||||
|
||||
@ -211,10 +211,10 @@ sub get_versions {
|
||||
}
|
||||
|
||||
sub lookup_name_by_id {
|
||||
return {FAILED => 1, message=> 'This method id depricated. Use Product::get instead.'};
|
||||
return {ERROR => 1, message=> 'This method id depricated. Use Product::get instead.'};
|
||||
}
|
||||
sub lookup_id_by_name {
|
||||
return {FAILED => 1, message=> 'This method id depricated. Use Product::check_product instead.'};
|
||||
return {ERROR => 1, message=> 'This method id depricated. Use Product::check_product instead.'};
|
||||
}
|
||||
|
||||
1;
|
||||
|
||||
@ -150,12 +150,12 @@ sub update {
|
||||
my $case = new Bugzilla::Testopia::TestCase($id);
|
||||
unless ($case){
|
||||
ThrowUserError("invalid-test-id-non-existent", {'id' => $id, 'type' => 'Case'}) if scalar @ids == 1;
|
||||
push @cases, {FAILED => 1, message => "TestCase $id does not exist"};
|
||||
push @cases, {ERROR => 1, message => "TestCase $id does not exist"};
|
||||
next;
|
||||
}
|
||||
unless ($case->canedit){
|
||||
ThrowUserError('testopia-read-only', {'object' => $case}) if scalar @ids == 1;
|
||||
push @cases, {FAILED => 1, message => "You do not have rights to edit this test case"};
|
||||
push @cases, {ERROR => 1, message => "You do not have rights to edit this test case"};
|
||||
next;
|
||||
}
|
||||
eval {
|
||||
@ -176,7 +176,7 @@ sub update {
|
||||
};
|
||||
|
||||
if ($@){
|
||||
push @cases, {FAILED => 1, message => $@};
|
||||
push @cases, {ERROR => 1, message => $@};
|
||||
}
|
||||
|
||||
$case->update;
|
||||
@ -249,22 +249,22 @@ sub attach_bug {
|
||||
foreach my $id (@ids){
|
||||
my $case = new Bugzilla::Testopia::TestCase($id);
|
||||
unless ($case){
|
||||
push @results, {FAILED => 1, message => "TestCase $id does not exist"};
|
||||
push @results, {ERROR => 1, message => "TestCase $id does not exist"};
|
||||
next;
|
||||
}
|
||||
unless ($case->canedit){
|
||||
push @results, {FAILED => 1, message => "You do not have rights to edit this test case"};
|
||||
push @results, {ERROR => 1, message => "You do not have rights to edit this test case"};
|
||||
next;
|
||||
}
|
||||
eval {
|
||||
$case->attach_bug($bug_ids);
|
||||
};
|
||||
if ($@){
|
||||
push @results, {FAILED => 1, message => $@};
|
||||
push @results, {ERROR => 1, message => $@};
|
||||
}
|
||||
}
|
||||
# @results will be empty if successful
|
||||
return @results;
|
||||
return \@results;
|
||||
}
|
||||
|
||||
sub detach_bug {
|
||||
@ -310,18 +310,18 @@ sub add_component {
|
||||
foreach my $id (@ids){
|
||||
my $case = new Bugzilla::Testopia::TestCase($id);
|
||||
unless ($case){
|
||||
push @results, {FAILED => 1, message => "TestCase $id does not exist"};
|
||||
push @results, {ERROR => 1, message => "TestCase $id does not exist"};
|
||||
next;
|
||||
}
|
||||
unless ($case->canedit){
|
||||
push @results, {FAILED => 1, message => "You do not have rights to edit this test case"};
|
||||
push @results, {ERROR => 1, message => "You do not have rights to edit this test case"};
|
||||
next;
|
||||
}
|
||||
eval {
|
||||
$case->add_component($component_ids);
|
||||
};
|
||||
if ($@){
|
||||
push @results, {FAILED => 1, message => $@};
|
||||
push @results, {ERROR => 1, message => $@};
|
||||
}
|
||||
}
|
||||
# @results will be empty if successful
|
||||
@ -339,18 +339,18 @@ sub remove_component {
|
||||
foreach my $id (@ids){
|
||||
my $case = new Bugzilla::Testopia::TestCase($id);
|
||||
unless ($case){
|
||||
push @results, {FAILED => 1, message => "TestCase $id does not exist"};
|
||||
push @results, {ERROR => 1, message => "TestCase $id does not exist"};
|
||||
next;
|
||||
}
|
||||
unless ($case->canedit){
|
||||
push @results, {FAILED => 1, message => "You do not have rights to edit this test case"};
|
||||
push @results, {ERROR => 1, message => "You do not have rights to edit this test case"};
|
||||
next;
|
||||
}
|
||||
eval {
|
||||
$case->remove_component($component_id);
|
||||
};
|
||||
if ($@){
|
||||
push @results, {FAILED => 1, message => $@};
|
||||
push @results, {ERROR => 1, message => $@};
|
||||
}
|
||||
}
|
||||
# @results will be empty if successful
|
||||
@ -383,18 +383,18 @@ sub add_tag {
|
||||
foreach my $id (@ids){
|
||||
my $case = new Bugzilla::Testopia::TestCase($id);
|
||||
unless ($case){
|
||||
push @results, {FAILED => 1, message => "TestCase $id does not exist"};
|
||||
push @results, {ERROR => 1, message => "TestCase $id does not exist"};
|
||||
next;
|
||||
}
|
||||
unless ($case->canedit){
|
||||
push @results, {FAILED => 1, message => "You do not have rights to edit this test case"};
|
||||
push @results, {ERROR => 1, message => "You do not have rights to edit this test case"};
|
||||
next;
|
||||
}
|
||||
eval {
|
||||
$case->add_tag($tags);
|
||||
};
|
||||
if ($@){
|
||||
push @results, {FAILED => 1, message => $@};
|
||||
push @results, {ERROR => 1, message => $@};
|
||||
}
|
||||
}
|
||||
# @results will be empty if successful
|
||||
@ -412,18 +412,18 @@ sub remove_tag {
|
||||
foreach my $id (@ids){
|
||||
my $case = new Bugzilla::Testopia::TestCase($id);
|
||||
unless ($case){
|
||||
push @results, {FAILED => 1, message => "TestCase $id does not exist"};
|
||||
push @results, {ERROR => 1, message => "TestCase $id does not exist"};
|
||||
next;
|
||||
}
|
||||
unless ($case->canedit){
|
||||
push @results, {FAILED => 1, message => "You do not have rights to edit this test case"};
|
||||
push @results, {ERROR => 1, message => "You do not have rights to edit this test case"};
|
||||
next;
|
||||
}
|
||||
eval {
|
||||
$case->remove_tag($tag_name);
|
||||
};
|
||||
if ($@){
|
||||
push @results, {FAILED => 1, message => $@};
|
||||
push @results, {ERROR => 1, message => $@};
|
||||
}
|
||||
}
|
||||
# @results will be empty if successful
|
||||
@ -473,7 +473,7 @@ sub link_plan {
|
||||
$case->link_plan($plan->id);
|
||||
};
|
||||
if ($@){
|
||||
push @results, {FAILED => 1, message => $@};
|
||||
push @results, {ERROR => 1, message => $@};
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -510,18 +510,18 @@ sub add_to_run {
|
||||
foreach my $id (@ids){
|
||||
my $case = new Bugzilla::Testopia::TestCase($id);
|
||||
unless ($case){
|
||||
push @results, {FAILED => 1, message => "TestCase $id does not exist"};
|
||||
push @results, {ERROR => 1, message => "TestCase $id does not exist"};
|
||||
next;
|
||||
}
|
||||
unless ($case->canedit){
|
||||
push @results, {FAILED => 1, message => "You do not have rights to edit this test case"};
|
||||
push @results, {ERROR => 1, message => "You do not have rights to edit this test case"};
|
||||
next;
|
||||
}
|
||||
eval {
|
||||
$case->add_to_run($run_ids);
|
||||
};
|
||||
if ($@){
|
||||
push @results, {FAILED => 1, message => $@};
|
||||
push @results, {ERROR => 1, message => $@};
|
||||
}
|
||||
}
|
||||
# @results will be empty if successful
|
||||
@ -573,11 +573,11 @@ sub calculate_average_time {
|
||||
}
|
||||
|
||||
sub lookup_category_id_by_name {
|
||||
return { FAILED => 1, message => 'This method is considered harmful and has been depricated. Please use Testopia::Product::check_catagory instead'};
|
||||
return { ERROR => 1, message => 'This method is considered harmful and has been depricated. Please use Testopia::Product::check_catagory instead'};
|
||||
}
|
||||
|
||||
sub lookup_category_name_by_id {
|
||||
return { FAILED => 1, message => 'This method has been depricated. Please use Testopia::Product::check_catagory instead'};
|
||||
return { ERROR => 1, message => 'This method has been depricated. Please use Testopia::Product::check_catagory instead'};
|
||||
}
|
||||
|
||||
sub lookup_priority_id_by_name {
|
||||
@ -1036,7 +1036,7 @@ Provides methods for automated scripts to manipulate Testopia TestCases
|
||||
Returns: Hash/Array: In the case of a single case it is returned. If a
|
||||
list was passed, it returns an array of case hashes. If the
|
||||
update on any particular case failed, the has will contain a
|
||||
FAILED key and the message as to why it failed.
|
||||
ERROR key and the message as to why it failed.
|
||||
+-------------------+----------------+
|
||||
| Field | Type |
|
||||
+-------------------+----------------+
|
||||
|
||||
@ -111,12 +111,12 @@ sub update {
|
||||
if (ref $case_id eq 'HASH' && !$build_id){
|
||||
$new_values = $case_id;
|
||||
foreach my $id (@ids){
|
||||
my $caserun = new Bugzilla::Testopia::TestCaseRun($run_id);
|
||||
my $caserun = new Bugzilla::Testopia::TestCaseRun($id);
|
||||
if ($caserun){
|
||||
push @caseruns, $caserun;
|
||||
}
|
||||
else {
|
||||
push @caseruns, {FAILED => 1, message => 'Case-run does not exist'};
|
||||
push @caseruns, {ERROR => 1, message => 'Case-run does not exist'};
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -127,7 +127,7 @@ sub update {
|
||||
push @caseruns, $caserun;
|
||||
}
|
||||
else {
|
||||
push @caseruns, {FAILED => 1, message => 'Case-run does not exist'};
|
||||
push @caseruns, {ERROR => 1, message => 'Case-run does not exist'};
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -140,12 +140,12 @@ sub update {
|
||||
my @results;
|
||||
|
||||
foreach my $caserun (@caseruns){
|
||||
if ($caserun->{'FAILED'}){
|
||||
if ($caserun->{'ERROR'}){
|
||||
push @results, $caserun;
|
||||
next;
|
||||
}
|
||||
unless ($caserun->canedit){
|
||||
push @results, {FAILED => 1, message => "You do not have rights to edit this test case"};
|
||||
push @results, {ERROR => 1, message => "You do not have rights to edit this test case"};
|
||||
next;
|
||||
}
|
||||
|
||||
@ -166,7 +166,8 @@ sub update {
|
||||
elsif ($new_values->{'environment_id'}){
|
||||
$caserun = $caserun->switch($build_id, $new_values->{'environment_id'}, $run_id, $case_id);
|
||||
}
|
||||
|
||||
|
||||
# Now that we know we are working with the right record, update it.
|
||||
if ($new_values->{'assignee'}){
|
||||
$caserun->set_assignee($new_values->{'assignee'});
|
||||
}
|
||||
@ -191,7 +192,7 @@ sub update {
|
||||
# Result is modified test case run on success, otherwise an exception will be thrown
|
||||
push @results, $caserun;
|
||||
}
|
||||
return @results;
|
||||
return \@results;
|
||||
}
|
||||
|
||||
sub lookup_status_id_by_name {
|
||||
@ -638,7 +639,7 @@ TestCaseRun->get($run_id, $case_id, $build_id, $environment_id)
|
||||
Returns: Hash/Array: In the case of a single object, it is returned. If a
|
||||
list was passed, it returns an array of object hashes. If the
|
||||
update on any particular object failed, the hash will contain a
|
||||
FAILED key and the message as to why it failed.
|
||||
ERROR key and the message as to why it failed.
|
||||
|
||||
=item C<update($run_id, $case_id, $build_id, $environment_id, $values)>
|
||||
|
||||
@ -655,7 +656,7 @@ TestCaseRun->get($run_id, $case_id, $build_id, $environment_id)
|
||||
Returns: Hash/Array: In the case of a single object, it is returned. If a
|
||||
list was passed, it returns an array of object hashes. If the
|
||||
update on any particular object failed, the hash will contain a
|
||||
FAILED key and the message as to why it failed.
|
||||
ERROR key and the message as to why it failed.
|
||||
|
||||
=back
|
||||
|
||||
|
||||
@ -239,22 +239,22 @@ sub add_tag {
|
||||
foreach my $id (@ids){
|
||||
my $plan = new Bugzilla::Testopia::TestPlan($id);
|
||||
unless ($plan){
|
||||
push @results, {FAILED => 1, message => "TestPlan $id does not exist"};
|
||||
push @results, {ERROR => 1, message => "TestPlan $id does not exist"};
|
||||
next;
|
||||
}
|
||||
unless ($plan->canedit){
|
||||
push @results, {FAILED => 1, message => "You do not have rights to edit this test plan"};
|
||||
push @results, {ERROR => 1, message => "You do not have rights to edit this test plan"};
|
||||
next;
|
||||
}
|
||||
eval {
|
||||
$plan->add_tag($tags);
|
||||
};
|
||||
if ($@){
|
||||
push @results, {FAILED => 1, message => $@};
|
||||
push @results, {ERROR => 1, message => $@};
|
||||
}
|
||||
}
|
||||
# @results will be empty if successful
|
||||
return @results;
|
||||
return \@results;
|
||||
}
|
||||
|
||||
sub remove_tag {
|
||||
|
||||
@ -200,11 +200,11 @@ sub get_test_plan {
|
||||
}
|
||||
|
||||
sub lookup_environment_id_by_name {
|
||||
return { FAILED => 1, message => 'This method is considered harmful and has been depricated. Please use Environment::check_environment instead'};
|
||||
return { ERROR => 1, message => 'This method is considered harmful and has been depricated. Please use Environment::check_environment instead'};
|
||||
}
|
||||
|
||||
sub lookup_environment_name_by_id {
|
||||
return { FAILED => 1, message => 'This method has been depricated. Please use Environment::get instead'};
|
||||
return { ERROR => 1, message => 'This method has been depricated. Please use Environment::get instead'};
|
||||
}
|
||||
|
||||
sub add_tag {
|
||||
@ -218,22 +218,22 @@ sub add_tag {
|
||||
foreach my $id (@ids){
|
||||
my $run = new Bugzilla::Testopia::TestRun($id);
|
||||
unless ($run){
|
||||
push @results, {FAILED => 1, message => "TestRun $id does not exist"};
|
||||
push @results, {ERROR => 1, message => "TestRun $id does not exist"};
|
||||
next;
|
||||
}
|
||||
unless ($run->canedit){
|
||||
push @results, {FAILED => 1, message => "You do not have rights to edit this test run"};
|
||||
push @results, {ERROR => 1, message => "You do not have rights to edit this test run"};
|
||||
next;
|
||||
}
|
||||
eval {
|
||||
$run->add_tag($tags);
|
||||
};
|
||||
if ($@){
|
||||
push @results, {FAILED => 1, message => $@};
|
||||
push @results, {ERROR => 1, message => $@};
|
||||
}
|
||||
}
|
||||
# @results will be empty if successful
|
||||
return @results;
|
||||
return \@results;
|
||||
}
|
||||
|
||||
sub remove_tag {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user