[Rt-commit] rt branch, 5.0/lifecycle-ui-mappings-handle-dashes, repushed
Craig Kaiser
craig at bestpractical.com
Mon Nov 16 16:17:43 EST 2020
The branch 5.0/lifecycle-ui-mappings-handle-dashes was deleted and repushed:
was ad800aac85ecf1fc030a144973f0297c961e2f4e
now 1e70d9333584be60c201c011cda83c85b0a0fffd
1: 160f41a5e6 = 1: 160f41a5e6 Update instructions for lifecycle mapping page to mention assets
2: de643a6cf9 ! 2: 93a6b498e0 Add general tests for the lifecycle Mappings.html page
@@ -1,6 +1,23 @@
Author: craig kaiser <craig at bestpractical.com>
Add general tests for the lifecycle Mappings.html page
+
+diff --git a/t/lifecycles/utils.pl b/t/lifecycles/utils.pl
+--- a/t/lifecycles/utils.pl
++++ b/t/lifecycles/utils.pl
+@@
+ active => ['on-your-mark', 'get-set', 'go'],
+ inactive => ['first', 'second', 'third', 'no-place'],
+ },
++ foo => {
++ type => 'ticket',
++ initial => ['initial'],
++ active => ['active'],
++ inactive => ['inactive'],
++ }
+ );
+ END
+ }
diff --git a/t/web/lifecycle_mappings.t b/t/web/lifecycle_mappings.t
new file mode 100644
@@ -10,29 +27,9 @@
+use strict;
+use warnings;
+
-+use RT::Test tests => undef;
++BEGIN {require './t/lifecycles/utils.pl'};
+
+my ( $url, $m ) = RT::Test->started_ok;
-+
-+my $lifecycleObj = RT::Lifecycle->new();
-+my $lifecycles = RT->Config->Get('Lifecycles');
-+
-+my $new_lifecycle = {
-+ %{$lifecycles},
-+ foo => {
-+ type => 'ticket',
-+ initial => ['initial'],
-+ active => ['active'],
-+ inactive => ['inactive'],
-+ }
-+};
-+
-+my ($ret, $msg) = $lifecycleObj->_SaveLifecycles(
-+ $new_lifecycle,
-+ RT->SystemUser,
-+);
-+ok $ret, "Updated lifecycle successfully";
-+RT::Lifecycle->FillCache();
+
+diag "Test updating mappings";
+{
@@ -67,7 +64,7 @@
+ RT::Lifecycle->FillCache();
+
+ my $foo = RT::Lifecycle->new();
-+ ($ret, $msg) = $foo->Load( Name => 'foo', Type => 'ticket' );
++ my ($ret, $msg) = $foo->Load( Name => 'foo', Type => 'ticket' );
+ ok $ret, "Loaded lifecycle foo successfully";
+
+ my $default = RT::Lifecycle->new();
3: 12443d485a = 3: a8593061a5 Update mapping form submission parsing to handle '-' in lifecycle name
4: ad800aac85 ! 4: 1e70d93335 Add test for when lifecycle has '-' in name
@@ -8,9 +8,9 @@
Mappings.html submission will interpret mappings forthe "sales-engineering"
lifecycle as a submission for the "sales" lifecycle.
-diff --git a/t/web/lifecycle_mappings.t b/t/web/lifecycle_mappings.t
---- a/t/web/lifecycle_mappings.t
-+++ b/t/web/lifecycle_mappings.t
+diff --git a/t/lifecycles/utils.pl b/t/lifecycles/utils.pl
+--- a/t/lifecycles/utils.pl
++++ b/t/lifecycles/utils.pl
@@
initial => ['initial'],
active => ['active'],
@@ -46,14 +46,18 @@
+ "sales-engineering -> default" => {
+ "deleted" => "deleted",
+ "sales" => "new",
-+ "engineering" => "new", # We want this to be different than the sales mapping
++ "engineering" => "open",
+ "rejected" => "rejected",
+ "resolved" => "resolved",
+ "stalled" => "stalled"
+ },
}
- };
-
+ );
+ END
+
+diff --git a/t/web/lifecycle_mappings.t b/t/web/lifecycle_mappings.t
+--- a/t/web/lifecycle_mappings.t
++++ b/t/web/lifecycle_mappings.t
@@
my $form = $m->form_name('ModifyMappings');
$m->submit_form(
@@ -123,3 +127,50 @@
if ( $default_from ) {
is ($input->value, $from->{$default_status}, "Mapping set correctly for default -> foo for status: $default_status" );
+@@
+ }
+ }
+
++diag "Test updating sales-engineering mappings";
++{
++ ok( $m->login( 'root', 'password' ), 'logged in' );
++
++ $m->get_ok( $url . '/Admin/Lifecycles/Mappings.html?Type=ticket&Name=sales-engineering' );
++
++ my $form = $m->form_name('ModifyMappings');
++ $m->submit_form(
++ fields => {
++ "map-sales-engineering--sales--default" => "new",
++ "map-sales-engineering--engineering--default" => "new", # Mapping we are changing
++ "map-sales-engineering--rejected--default" => "rejected",
++ "map-sales-engineering--resolved--default" => "resolved",
++ "map-sales-engineering--stalled--default" => "stalled",
++ "Name" => "sales-engineering",
++ "Type" => "ticket",
++ },
++ button => 'Update'
++ );
++ $m->content_contains( 'Lifecycle mappings updated' );
++ $form = $m->form_name('ModifyMappings');
++
++ my $from = {
++ sales => "new",
++ engineering => "new", # Changed mapping
++ stalled => "stalled",
++ rejected => "rejected",
++ resolved => "resolved",
++ deleted => "deleted",
++ };
++
++ # Ensure that the UI correctly reflects the changes we made
++ my @inputs = $form->inputs;
++ foreach my $input ( @inputs ) {
++ my ($sales_engineering, $status, $to) = $input->name =~ /^map-(sales-engineering)--(.*)--(default)$/;
++ next unless $from && $status && $to;
++ is ($input->value, $from->{$status}, "Mapping set correctly for sales-engineering -> default for status: $status" );
++ delete $from->{$status};
++ }
++ ok scalar keys %{$from} eq 0, "Checked all sales-engineering -> default mappings.";
++}
++
+ done_testing;
More information about the rt-commit
mailing list