summaryrefslogtreecommitdiff
path: root/t
diff options
context:
space:
mode:
authorAitik Dandapat <adandapa@redhat.com>2021-09-17 16:39:52 +0530
committerJeff Fearn <jfearn@redhat.com>2021-11-16 14:49:01 +1000
commit37b29883dc3d5c20835887fd539ee6011db9e5e5 (patch)
treea5b1ea8bdb2884552708d96434c4ec23fb87adbd /t
parentBug 2023136 - Log user name for account disabled log entry (diff)
downloadbugzilla-37b29883dc3d5c20835887fd539ee6011db9e5e5.tar.gz
bugzilla-37b29883dc3d5c20835887fd539ee6011db9e5e5.tar.bz2
bugzilla-37b29883dc3d5c20835887fd539ee6011db9e5e5.zip
Bug 2005292 - Red Hat Bugzilla doesn't allow to specify only comments ids in query's include_fields
Removed the type field Change-Id: I98451cbe1edcfee18e63720c88058d7c139e01d1
Diffstat (limited to 't')
-rw-r--r--t/300rpc.t30
-rw-r--r--t/320rpc.t9
2 files changed, 38 insertions, 1 deletions
diff --git a/t/300rpc.t b/t/300rpc.t
index 38003f50d..cb5d620a4 100644
--- a/t/300rpc.t
+++ b/t/300rpc.t
@@ -4,7 +4,9 @@ use strict;
use warnings;
use lib qw(. lib t);
-use Test::More tests => 79;
+
+# Each call to run_rpc adds 3 tests
+use Test::More tests => 87;
use Capture::Tiny ':all';
use HTTP::Parser;
@@ -137,6 +139,28 @@ $res = run_rpc('Bug.get', \%args);
%args = (ids => [$bug_id], status => 'ASSIGNED',);
$res = run_rpc('Bug.update', \%args);
+# Bug 2005292 - 'comments.id' should return only ID
+%args = (ids => [$bug_id], include_fields => ['id', 'comments.id']);
+$res = run_rpc('Bug.search', \%args);
+ok(
+ exists $res->{'result'}->{'bugs'}
+ && exists $res->{'result'}->{'bugs'}->[0]->{'comments'}
+ && exists $res->{'result'}->{'bugs'}->[0]->{'comments'}->[0]->{'id'}
+ && scalar keys(%{$res->{'result'}->{'bugs'}->[0]->{'comments'}->[0]}) == 1,
+ 'Comments have 1 key and it is "id"'
+) || diag(explain $res);
+
+# Bug 2005292 - 'comments' should return more that ID
+%args = (ids => [$bug_id], include_fields => ['id', 'comments']);
+$res = run_rpc('Bug.search', \%args);
+ok(
+ exists $res->{'result'}->{'bugs'}
+ && exists $res->{'result'}->{'bugs'}->[0]->{'comments'}
+ && exists $res->{'result'}->{'bugs'}->[0]->{'comments'}->[0]->{'id'}
+ && scalar keys(%{$res->{'result'}->{'bugs'}->[0]->{'comments'}->[0]}) > 1,
+ 'Comments have more than 1 key'
+) || diag(explain $res);
+
#flagtype
%args = (
name => 'TheFlag',
@@ -256,6 +280,10 @@ sub run_rpc {
params => ($params || {}),
);
+ if ($rpc_debug) {
+ diag explain \%args;
+ }
+
$cgi->delete_all();
$cgi->cgi_error("");
$cgi->param('POSTDATA', to_json(\%args));
diff --git a/t/320rpc.t b/t/320rpc.t
index d37147334..f3db92f1d 100644
--- a/t/320rpc.t
+++ b/t/320rpc.t
@@ -3,6 +3,8 @@ use strict;
use warnings;
use lib qw(. lib t);
+
+# Each call to run_rpc adds 3 tests
use Test::More tests => 21;
use Capture::Tiny ':all';
@@ -89,6 +91,9 @@ exit;
sub run_rpc {
my ($method, $params) = @_;
+ ## We need to reset this as the cache survives calls
+ Bugzilla->request_cache->{filter_wants} = {};
+
my %args = (
method => $method,
version => "1.1",
@@ -96,6 +101,10 @@ sub run_rpc {
params => ($params || {}),
);
+ if ($rpc_debug) {
+ diag explain \%args;
+ }
+
$cgi->delete_all();
$cgi->cgi_error("");
$cgi->param('POSTDATA', to_json(\%args));