[Rt-commit] rt branch, 4.6/configindatabase-themed, updated. rt-4.4.4-553-g4d7594e511
Blaine Motsinger
blaine at bestpractical.com
Fri Nov 22 10:46:49 EST 2019
The branch, 4.6/configindatabase-themed has been updated
via 4d7594e5111450930b1611e6ef9cf7b7b0b0524d (commit)
from 165ca1445fd4beb962b334471ac8dc34c91cde4b (commit)
Summary of changes:
t/web/admin_tools_editconfig.t | 76 ++++++++++++++++++++++++++++++++++++++++++
1 file changed, 76 insertions(+)
create mode 100644 t/web/admin_tools_editconfig.t
- Log -----------------------------------------------------------------
commit 4d7594e5111450930b1611e6ef9cf7b7b0b0524d
Author: Blaine Motsinger <blaine at bestpractical.com>
Date: Fri Nov 22 09:44:36 2019 -0600
Add test for /Admin/Tools/EditConfig.html
This test changes and verifies one of each of the data types through
the UI.
diff --git a/t/web/admin_tools_editconfig.t b/t/web/admin_tools_editconfig.t
new file mode 100644
index 0000000000..0b7430728e
--- /dev/null
+++ b/t/web/admin_tools_editconfig.t
@@ -0,0 +1,76 @@
+use strict;
+use warnings;
+
+use RT::Test tests => undef;
+
+my ( $url, $m ) = RT::Test->started_ok;
+ok( $m->login(), 'logged in' );
+
+$m->get_ok( $url . '/Admin/Tools/EditConfig.html' );
+
+my $tests = [
+ {
+ name => 'change a string value',
+ form_id => 'form-System-Base_configuration',
+ setting => 'CorrespondAddress',
+ new_value => 'rt-correspond-edited at example.com',
+ },
+ {
+ name => 'change a boolean value',
+ form_id => 'form-System-Outgoing_mail',
+ setting => 'NotifyActor',
+ new_value => 1,
+ },
+ {
+ name => 'change an arrayref value',
+ form_id => 'form-System-Extra_security',
+ setting => 'ReferrerWhitelist',
+ new_value => stringify( ['www.example.com:443', 'www3.example.com:80'] ),
+ },
+ {
+ name => 'change a hashref value',
+ form_id => 'form-System-Outgoing_mail',
+ setting => 'OverrideOutgoingMailFrom',
+ new_value => stringify( { 1 => 'new-outgoing-from at example.com' } ),
+ },
+];
+
+run_test( %{$_} ) for @{$tests};
+
+sub run_test {
+ my %args = @_;
+
+ note $args{name} if $ENV{TEST_VERBOSE};
+
+ $m->submit_form_ok(
+ {
+ form_id => $args{form_id},
+ fields => {
+ $args{setting} => $args{new_value}
+ },
+ },
+ 'form was submitted successfully'
+ );
+
+ $m->content_like( qr/$args{setting} changed from/, 'UI indicated the value was changed' );
+
+ my $config_value = RT::Configuration->new( RT->SystemUser );
+ $config_value->Load( $args{setting} );
+
+ is( $config_value->Content, $args{new_value}, 'new value was changed in the config' );
+}
+
+sub stringify {
+ my $value = shift;
+
+ require Data::Dumper;
+ local $Data::Dumper::Terse = 1;
+ local $Data::Dumper::Indent = 2;
+ local $Data::Dumper::Sortkeys = 1;
+
+ my $output = Data::Dumper::Dumper $value;
+ chomp $output;
+ return $output;
+}
+
+done_testing;
-----------------------------------------------------------------------
More information about the rt-commit
mailing list