[Rt-commit] rt branch, 5.0/rest2-remove-outdated-tests, created. rt-5.0.1-427-gd773a10e8b

? sunnavy sunnavy at bestpractical.com
Fri Jun 4 09:19:45 EDT 2021


The branch, 5.0/rest2-remove-outdated-tests has been created
        at  d773a10e8b03e01da590145168e0552dbd5dc2b8 (commit)

- Log -----------------------------------------------------------------
commit d773a10e8b03e01da590145168e0552dbd5dc2b8
Author: sunnavy <sunnavy at bestpractical.com>
Date:   Fri Jun 4 16:28:15 2021 +0800

    Remove outdated test code that's for RT 4

diff --git a/t/rest2/asset-customfields.t b/t/rest2/asset-customfields.t
index 433d3be5a6..0623801e6b 100644
--- a/t/rest2/asset-customfields.t
+++ b/t/rest2/asset-customfields.t
@@ -3,11 +3,6 @@ use warnings;
 use RT::Test::REST2 tests => undef;
 use Test::Deep;
 
-BEGIN {
-    plan skip_all => 'RT 4.4 required'
-        unless RT::Handle::cmp_version($RT::VERSION, '4.4.0') >= 0;
-}
-
 my $mech = RT::Test::REST2->mech;
 
 my $auth = RT::Test::REST2->authorization_header;
diff --git a/t/rest2/assets.t b/t/rest2/assets.t
index 619564ae9c..1ebc373002 100644
--- a/t/rest2/assets.t
+++ b/t/rest2/assets.t
@@ -3,11 +3,6 @@ use warnings;
 use RT::Test::REST2 tests => undef;
 use Test::Deep;
 
-BEGIN {
-    plan skip_all => 'RT 4.4 required'
-        unless RT::Handle::cmp_version($RT::VERSION, '4.4.0') >= 0;
-}
-
 my $mech = RT::Test::REST2->mech;
 
 my $auth = RT::Test::REST2->authorization_header;
diff --git a/t/rest2/catalogs.t b/t/rest2/catalogs.t
index 685f6e29fd..95afc1f67d 100644
--- a/t/rest2/catalogs.t
+++ b/t/rest2/catalogs.t
@@ -2,11 +2,6 @@ use strict;
 use warnings;
 use RT::Test::REST2 tests => undef;
 
-BEGIN {
-    plan skip_all => 'RT 4.4 required'
-        unless RT::Handle::cmp_version($RT::VERSION, '4.4.0') >= 0;
-}
-
 my $mech = RT::Test::REST2->mech;
 my $auth = RT::Test::REST2->authorization_header;
 my $rest_base_path = '/REST/2.0';
diff --git a/t/rest2/customfields.t b/t/rest2/customfields.t
index 61968f48d3..022093c407 100644
--- a/t/rest2/customfields.t
+++ b/t/rest2/customfields.t
@@ -131,8 +131,7 @@ my $freeform_cf_id;
     is($content->{MaxValues}, 1);
     is($content->{Disabled}, 0);
 
-    my @fields = qw(SortOrder Pattern Created Creator LastUpdated LastUpdatedBy);
-    push @fields, qw(UniqueValues EntryHint) if RT::Handle::cmp_version($RT::VERSION, '4.4.0') >= 0;
+    my @fields = qw(SortOrder Pattern Created Creator LastUpdated LastUpdatedBy UniqueValues EntryHint);
     ok(exists $content->{$_}, "got $_") for @fields;
 
     my $links = $content->{_hyperlinks};
@@ -158,8 +157,7 @@ my $freeform_cf_id;
     is($content->{MaxValues}, 1);
     is($content->{Disabled}, 0);
 
-    my @fields = qw(SortOrder Pattern Created Creator LastUpdated LastUpdatedBy);
-    push @fields, qw(UniqueValues EntryHint) if RT::Handle::cmp_version($RT::VERSION, '4.4.0') >= 0;
+    my @fields = qw(SortOrder Pattern Created Creator LastUpdated LastUpdatedBy UniqueValues EntryHint);
     ok(exists $content->{$_}, "got $_") for @fields;
 
     my $links = $content->{_hyperlinks};
@@ -191,8 +189,7 @@ my $freeform_cf_id;
     is($content->{MaxValues}, 1);
     is($content->{Disabled}, 0);
 
-    my @fields = qw(SortOrder Pattern Created Creator LastUpdated LastUpdatedBy);
-    push @fields, qw(UniqueValues EntryHint) if RT::Handle::cmp_version($RT::VERSION, '4.4.0') >= 0;
+    my @fields = qw(SortOrder Pattern Created Creator LastUpdated LastUpdatedBy UniqueValues EntryHint);
     ok(exists $content->{$_}, "got $_") for @fields;
 
     my $links = $content->{_hyperlinks};
@@ -224,8 +221,7 @@ my $freeform_cf_id;
     is($content->{MaxValues}, 1);
     is($content->{Disabled}, 0);
 
-    my @fields = qw(SortOrder Pattern Created Creator LastUpdated LastUpdatedBy);
-    push @fields, qw(UniqueValues EntryHint) if RT::Handle::cmp_version($RT::VERSION, '4.4.0') >= 0;
+    my @fields = qw(SortOrder Pattern Created Creator LastUpdated LastUpdatedBy UniqueValues EntryHint);
     ok(exists $content->{$_}, "got $_") for @fields;
 
     my $links = $content->{_hyperlinks};
@@ -257,8 +253,7 @@ my $freeform_cf_id;
     is($content->{MaxValues}, 1);
     is($content->{Disabled}, 0);
 
-    my @fields = qw(SortOrder Pattern Created Creator LastUpdated LastUpdatedBy);
-    push @fields, qw(UniqueValues EntryHint) if RT::Handle::cmp_version($RT::VERSION, '4.4.0') >= 0;
+    my @fields = qw(SortOrder Pattern Created Creator LastUpdated LastUpdatedBy UniqueValues EntryHint);
     ok(exists $content->{$_}, "got $_") for @fields;
 
     my $links = $content->{_hyperlinks};
@@ -293,8 +288,7 @@ my $freeform_cf_id;
     is($content->{MaxValues}, 1);
     is($content->{Disabled}, 0);
 
-    my @fields = qw(SortOrder Pattern Created Creator LastUpdated LastUpdatedBy);
-    push @fields, qw(UniqueValues EntryHint) if RT::Handle::cmp_version($RT::VERSION, '4.4.0') >= 0;
+    my @fields = qw(SortOrder Pattern Created Creator LastUpdated LastUpdatedBy UniqueValues EntryHint);
     ok(exists $content->{$_}, "got $_") for @fields;
 
     my $links = $content->{_hyperlinks};
diff --git a/t/rest2/queues.t b/t/rest2/queues.t
index 5ab1049168..25c2b06df9 100644
--- a/t/rest2/queues.t
+++ b/t/rest2/queues.t
@@ -74,8 +74,7 @@ my $queue_url;
     is($content->{Lifecycle}, 'default');
     is($content->{Disabled}, 0);
 
-    my @fields = qw(LastUpdated Created CorrespondAddress CommentAddress);
-    push @fields, qw(SortOrder SLADisabled) if RT::Handle::cmp_version($RT::VERSION, '4.4.0') >= 0;
+    my @fields = qw(LastUpdated Created CorrespondAddress CommentAddress SortOrder SLADisabled);
     ok(exists $content->{$_}, "got $_") for @fields;
 
     my $links = $content->{_hyperlinks};
@@ -226,8 +225,7 @@ my ($features_url, $features_id);
     is($content->{Lifecycle}, 'default');
     is($content->{Disabled}, 0);
 
-    my @fields = qw(LastUpdated Created CorrespondAddress CommentAddress);
-    push @fields, qw(SortOrder SLADisabled) if RT::Handle::cmp_version($RT::VERSION, '4.4.0') >= 0;
+    my @fields = qw(LastUpdated Created CorrespondAddress CommentAddress SortOrder SLADisabled);
     ok(exists $content->{$_}, "got $_") for @fields;
 
     my $links = $content->{_hyperlinks};
diff --git a/t/rest2/ticket-customfields.t b/t/rest2/ticket-customfields.t
index 88722942b9..21ddc7cbec 100644
--- a/t/rest2/ticket-customfields.t
+++ b/t/rest2/ticket-customfields.t
@@ -61,13 +61,6 @@ my ($ticket_url_cf_by_name, $ticket_id_cf_by_name);
     };
 
 
-    # 4.2.3 introduced a bug (e092e23) in CFs fixed in 4.2.9 (ab7ea15)
-    if (   RT::Handle::cmp_version($RT::VERSION, '4.2.3') >= 0
-        && RT::Handle::cmp_version($RT::VERSION, '4.2.8') <= 0) {
-        delete $payload->{CustomFields};
-        delete $payload_cf_by_name->{CustomFields};
-    };
-
     # Rights Test - No CreateTicket
     my $res = $mech->post_json("$rest_base_path/ticket",
         $payload,
@@ -118,7 +111,7 @@ my ($ticket_url_cf_by_name, $ticket_id_cf_by_name);
     is($res->code, 201);
 
    TODO: {
-       local $TODO = "this warns due to specifying a CF with no permission to see" if RT::Handle::cmp_version($RT::VERSION, '4.4.0') || RT::Handle::cmp_version($RT::VERSION, '4.4.4') >= 0;
+       local $TODO = "this warns due to specifying a CF with no permission to see";
        is(@warnings, 0, "no warnings") or diag(join("\n",'warnings : ', @warnings));
    }
 
@@ -628,17 +621,10 @@ for my $value (
     modify_multi_ok('replace all', ['replace all added as a value for Multi', 'multiple is no longer a value for custom field Multi', 'new is no longer a value for custom field Multi'], ['replace all'], 'replaced all values');
     modify_multi_ok([], ['replace all is no longer a value for custom field Multi'], [], 'removed all values');
 
-    if (RT::Handle::cmp_version($RT::VERSION, '4.2.5') >= 0) {
-        modify_multi_ok(['foo', 'foo', 'bar'], ['foo added as a value for Multi', undef, 'bar added as a value for Multi'], ['bar', 'foo'], 'multiple values with the same name');
-        modify_multi_ok(['foo', 'bar'], [], ['bar', 'foo'], 'multiple values with the same name');
-        modify_multi_ok(['bar'], ['foo is no longer a value for custom field Multi'], ['bar'], 'multiple values with the same name');
-        modify_multi_ok(['bar', 'bar', 'bar'], [undef, undef], ['bar'], 'multiple values with the same name');
-    } else {
-        modify_multi_ok(['foo', 'foo', 'bar'], ['foo added as a value for Multi', 'foo added as a value for Multi', 'bar added as a value for Multi'], ['bar', 'foo', 'foo'], 'multiple values with the same name');
-        modify_multi_ok(['foo', 'bar'], ['foo is no longer a value for custom field Multi'], ['bar', 'foo'], 'multiple values with the same name');
-        modify_multi_ok(['bar'], ['foo is no longer a value for custom field Multi'], ['bar'], 'multiple values with the same name');
-        modify_multi_ok(['bar', 'bar', 'bar'], ['bar added as a value for Multi', 'bar added as a value for Multi'], ['bar', 'bar', 'bar'], 'multiple values with the same name');
-    }
+    modify_multi_ok(['foo', 'foo', 'bar'], ['foo added as a value for Multi', undef, 'bar added as a value for Multi'], ['bar', 'foo'], 'multiple values with the same name');
+    modify_multi_ok(['foo', 'bar'], [], ['bar', 'foo'], 'multiple values with the same name');
+    modify_multi_ok(['bar'], ['foo is no longer a value for custom field Multi'], ['bar'], 'multiple values with the same name');
+    modify_multi_ok(['bar', 'bar', 'bar'], [undef, undef], ['bar'], 'multiple values with the same name');
 }
 
 # Ticket Creation with image CF through JSON Base64
@@ -894,28 +880,14 @@ my $multi_image_cf_id = $multi_image_cf->id;
     $ticket->Load($ticket_id);
     @multi_image_ocfvs = @{$ticket->CustomFieldValues('Multi Image CF')->ItemsArrayRef};
 
-    if (RT::Handle::cmp_version($RT::VERSION, '4.2.5') >= 0) {
-        is_deeply($mech->json_response, ["Ticket $ticket_id: Subject changed from 'Ticket with deletion of one value for multi-value image CF' to 'Ticket with non-unique values for multi-value image CF'", undef, "Duplicate added as a value for Multi Image CF"]);
-        is(scalar(@multi_image_ocfvs), 2);
-        is($multi_image_ocfvs[0]->Content, $image_name);
-        is($multi_image_ocfvs[0]->ContentType, 'image/png');
-        is($multi_image_ocfvs[0]->LargeContent, $image_content);
-        is($multi_image_ocfvs[1]->Content, 'Duplicate');
-        is($multi_image_ocfvs[1]->ContentType, 'image/png');
-        is($multi_image_ocfvs[1]->LargeContent, $image_content);
-    } else {
-        is_deeply($mech->json_response, ["Ticket $ticket_id: Subject changed from 'Ticket with deletion of one value for multi-value image CF' to 'Ticket with non-unique values for multi-value image CF'", "$image_name added as a value for Multi Image CF", "Duplicate added as a value for Multi Image CF"]);
-        is(scalar(@multi_image_ocfvs), 3);
-        is($multi_image_ocfvs[0]->Content, $image_name);
-        is($multi_image_ocfvs[0]->ContentType, 'image/png');
-        is($multi_image_ocfvs[0]->LargeContent, $image_content);
-        is($multi_image_ocfvs[1]->Content, $image_name);
-        is($multi_image_ocfvs[1]->ContentType, 'image/png');
-        is($multi_image_ocfvs[1]->LargeContent, $image_content);
-        is($multi_image_ocfvs[2]->Content, 'Duplicate');
-        is($multi_image_ocfvs[2]->ContentType, 'image/png');
-        is($multi_image_ocfvs[2]->LargeContent, $image_content);
-    }
+    is_deeply($mech->json_response, ["Ticket $ticket_id: Subject changed from 'Ticket with deletion of one value for multi-value image CF' to 'Ticket with non-unique values for multi-value image CF'", undef, "Duplicate added as a value for Multi Image CF"]);
+    is(scalar(@multi_image_ocfvs), 2);
+    is($multi_image_ocfvs[0]->Content, $image_name);
+    is($multi_image_ocfvs[0]->ContentType, 'image/png');
+    is($multi_image_ocfvs[0]->LargeContent, $image_content);
+    is($multi_image_ocfvs[1]->Content, 'Duplicate');
+    is($multi_image_ocfvs[1]->ContentType, 'image/png');
+    is($multi_image_ocfvs[1]->LargeContent, $image_content);
 }
 
 # Ticket Creation with image CF through multipart/form-data
@@ -1150,28 +1122,14 @@ my $json = JSON->new->utf8;
     $ticket->Load($ticket_id);
     @multi_image_ocfvs = @{$ticket->CustomFieldValues('Multi Image CF')->ItemsArrayRef};
 
-    if (RT::Handle::cmp_version($RT::VERSION, '4.2.5') >= 0) {
-        is_deeply($mech->json_response, ["Ticket $ticket_id: Subject changed from 'Ticket with deletion of one value for multi-value image CF' to 'Ticket with non-unique values for multi-value image CF'", undef, "Duplicate added as a value for Multi Image CF"]);
-        is(scalar(@multi_image_ocfvs), 2);
-        is($multi_image_ocfvs[0]->Content, $image_name);
-        is($multi_image_ocfvs[0]->ContentType, 'image/png');
-        is($multi_image_ocfvs[0]->LargeContent, $image_content);
-        is($multi_image_ocfvs[1]->Content, 'Duplicate');
-        is($multi_image_ocfvs[1]->ContentType, 'image/png');
-        is($multi_image_ocfvs[1]->LargeContent, $image_content);
-    } else {
-        is_deeply($mech->json_response, ["Ticket $ticket_id: Subject changed from 'Ticket with deletion of one value for multi-value image CF' to 'Ticket with non-unique values for multi-value image CF'", "$image_name added as a value for Multi Image CF", "Duplicate added as a value for Multi Image CF"]);
-        is(scalar(@multi_image_ocfvs), 3);
-        is($multi_image_ocfvs[0]->Content, $image_name);
-        is($multi_image_ocfvs[0]->ContentType, 'image/png');
-        is($multi_image_ocfvs[0]->LargeContent, $image_content);
-        is($multi_image_ocfvs[1]->Content, $image_name);
-        is($multi_image_ocfvs[1]->ContentType, 'image/png');
-        is($multi_image_ocfvs[1]->LargeContent, $image_content);
-        is($multi_image_ocfvs[2]->Content, 'Duplicate');
-        is($multi_image_ocfvs[2]->ContentType, 'image/png');
-        is($multi_image_ocfvs[2]->LargeContent, $image_content);
-    }
+    is_deeply($mech->json_response, ["Ticket $ticket_id: Subject changed from 'Ticket with deletion of one value for multi-value image CF' to 'Ticket with non-unique values for multi-value image CF'", undef, "Duplicate added as a value for Multi Image CF"]);
+    is(scalar(@multi_image_ocfvs), 2);
+    is($multi_image_ocfvs[0]->Content, $image_name);
+    is($multi_image_ocfvs[0]->ContentType, 'image/png');
+    is($multi_image_ocfvs[0]->LargeContent, $image_content);
+    is($multi_image_ocfvs[1]->Content, 'Duplicate');
+    is($multi_image_ocfvs[1]->ContentType, 'image/png');
+    is($multi_image_ocfvs[1]->LargeContent, $image_content);
 }
 
 {
diff --git a/t/rest2/ticket-customroles.t b/t/rest2/ticket-customroles.t
index 0433911ea6..e35378dc37 100644
--- a/t/rest2/ticket-customroles.t
+++ b/t/rest2/ticket-customroles.t
@@ -2,11 +2,6 @@ use strict;
 use warnings;
 use RT::Test::REST2 tests => undef;
 
-BEGIN {
-    plan skip_all => 'RT 4.4 required'
-        unless RT::Handle::cmp_version($RT::VERSION, '4.4.0') >= 0;
-}
-
 use Test::Deep;
 
 my $mech = RT::Test::REST2->mech;

-----------------------------------------------------------------------


More information about the rt-commit mailing list