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

Jim Brandt jbrandt at bestpractical.com
Fri Jun 4 14:52:38 EDT 2021


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

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

    Remove outdated rest 2 test code that's for RT 4
    
    The RT 4.4 tests came in when we merged the REST 2 code
    from the stand-alone extension. Since the REST 2 code
    in core RT lives only in RT 5.0 and later, we don't need
    the RT 4.4 tests here.

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;

commit d281823d86a6f46e9d6bca547d13bbb9bf7597c3
Author: Jim Brandt <jbrandt at bestpractical.com>
Date:   Fri Jun 4 14:49:54 2021 -0400

    Revert github actions change to pull all repo information on checkout
    
    f468dea6c updated the github actions repo checkout behavior to
    support getting RT version information for some tests. 5cf761e7a
    removed these version-dependent tests since they are not needed
    for RT 5.0, so we can revert to the default (and reportedly
    faster) single repo checkout for running tests in github actions.

diff --git a/.github/workflows/github-action.yml b/.github/workflows/github-action.yml
index 94ff437c6b..fa2dcd82cf 100644
--- a/.github/workflows/github-action.yml
+++ b/.github/workflows/github-action.yml
@@ -14,8 +14,6 @@ jobs:
           echo "RT_GA_START_TIME=$(date +%s)" >> $GITHUB_ENV
       - name: Check out RT
         uses: actions/checkout at v2
-        with:
-          fetch-depth: 0
       - name: Build RT
         env:
           RT_TEST_PARALLEL: 1
@@ -63,8 +61,6 @@ jobs:
           echo "RT_GA_START_TIME=$(date +%s)" >> $GITHUB_ENV
       - name: Checkout RT
         uses: actions/checkout at v2
-        with:
-          fetch-depth: 0
       - name: Build RT
         env:
           RT_TEST_PARALLEL: 1
@@ -121,8 +117,6 @@ jobs:
           echo "RT_GA_START_TIME=$(date +%s)" >> $GITHUB_ENV
       - name: Checkout RT
         uses: actions/checkout at v2
-        with:
-          fetch-depth: 0
       - name: Build RT
         env:
           DB_VERSION_TAG: 9.6

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


More information about the rt-commit mailing list