[Rt-commit] rt branch, 5.0/lifecycle-ui-update-cache, created. rt-5.0.0alpha1-262-g6ccc65fa2b

Craig Kaiser craig at bestpractical.com
Wed May 6 17:19:19 EDT 2020


The branch, 5.0/lifecycle-ui-update-cache has been created
        at  6ccc65fa2b8d3f1b2a5be948f0859d0ccc384568 (commit)

- Log -----------------------------------------------------------------
commit 6ccc65fa2b8d3f1b2a5be948f0859d0ccc384568
Author: Craig <craig at bestpractical.com>
Date:   Wed May 6 17:07:58 2020 -0400

    Add tests for lifecycle-ui caching when config is updated

diff --git a/t/web/lifecycle_ui.t b/t/web/lifecycle_ui.t
new file mode 100644
index 0000000000..3ab462d6fd
--- /dev/null
+++ b/t/web/lifecycle_ui.t
@@ -0,0 +1,48 @@
+use strict;
+use warnings;
+
+use JSON qw/decode_json encode_json/;
+use RT::Lifecycle;
+
+use RT::Test tests => undef;
+my ($baseurl, $m) = RT::Test->started_ok;
+
+ok $m->login;
+
+my $queue = RT::Queue->new( RT->SystemUser );
+ok $queue->Load( 'General' );
+
+my ($t) = RT::Test->create_tickets(
+    { Queue => $queue->Id, Status => 'open' },
+    { },
+);
+
+$m->get( "$baseurl/Admin/Lifecycles/Advanced.html?Type=ticket;Name=".$queue->Lifecycle );
+# Go to the advanced page of Lifecycle UI
+my $advanced_form = $m->form_name( 'ModifyLifecycleAdvanced' );
+my $config = $advanced_form->find_input( 'Config' );
+
+my $new_config = decode_json($config->value);
+
+$new_config->{'active'} = ['stalled'];
+push @{$new_config->{'inactive'}}, 'open';
+my $json = encode_json( $new_config );
+
+$m->submit_form(
+    form_name => 'ModifyLifecycleAdvanced',
+    fields    => { Config => $json },
+    button    => 'Update',
+);
+ok( $m->content_contains('Lifecycle updated'), "Lifecycle updated from advanced page" );
+
+RT->Config->LoadConfigFromDatabase();
+
+my $lifecycle_config = RT->Config->Get('Lifecycles')->{$queue->Lifecycle};
+
+ok ( grep $_ eq 'open', @{$lifecycle_config->{'inactive'}}, "Lifecycle configuration value has open as inactive status" );
+ok ( grep $_ eq 'open', @{$RT::Lifecycle::LIFECYCLES_CACHE{ $queue->Lifecycle }->{'inactive'}}, "Lifecycle cache has open as inactive status" );
+
+$m->get($baseurl);
+ok( !$m->find_link( text => '(No subject)' ), "Open ticket does not show up in active ticket search after lifecycle update" );
+
+done_testing();

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


More information about the rt-commit mailing list