[Rt-commit] rt branch, admin_ui, updated. 23412e5a8a8d1a644cd0db4ee3fea2e13d12e352
sunnavy at bestpractical.com
sunnavy at bestpractical.com
Mon Jan 18 05:40:45 EST 2010
The branch, admin_ui has been updated
via 23412e5a8a8d1a644cd0db4ee3fea2e13d12e352 (commit)
from f71d8ad328800c3fddb7d4e367ba95121e761be8 (commit)
Summary of changes:
t/web/admin/global_custom_fields.t | 50 +++++++++++++++++++++
t/web/admin/global_jifty.t | 10 ++++
t/web/admin/global_myrt.t | 20 +++++++++
t/web/admin/global_rights.t | 66 ++++++++++++++++++++++++++++
t/web/admin/global_system.t | 18 ++++++++
t/web/admin/global_templates.t | 35 +++++++++++++++
t/web/admin/global_workflows.t | 83 ++++++++++++++++++++++++++++++++++++
7 files changed, 282 insertions(+), 0 deletions(-)
create mode 100644 t/web/admin/global_custom_fields.t
create mode 100644 t/web/admin/global_jifty.t
create mode 100644 t/web/admin/global_myrt.t
create mode 100644 t/web/admin/global_rights.t
create mode 100644 t/web/admin/global_system.t
create mode 100644 t/web/admin/global_templates.t
create mode 100644 t/web/admin/global_workflows.t
- Log -----------------------------------------------------------------
commit 23412e5a8a8d1a644cd0db4ee3fea2e13d12e352
Author: sunnavy <sunnavy at bestpractical.com>
Date: Mon Jan 18 18:35:51 2010 +0800
add /admin/global tests
diff --git a/t/web/admin/global_custom_fields.t b/t/web/admin/global_custom_fields.t
new file mode 100644
index 0000000..9b0edb4
--- /dev/null
+++ b/t/web/admin/global_custom_fields.t
@@ -0,0 +1,50 @@
+#!/usr/bin/env perl
+
+use strict;
+use RT::Test strict => 0, tests => 15, l10n => 1;
+
+my ( $baseurl, $agent ) = RT::Test->started_ok;
+ok( $agent->login, 'logged in' );
+
+# let's create a cf for ticket
+my $cf = RT::Model::CustomField->new( current_user => RT->system_user );
+for my $name (qw/foo bar/) {
+ ok(
+ $cf->create(
+ name => $name,
+ lookup_type => 'RT::Model::Queue-RT::Model::Ticket',
+ type => 'Freeform',
+ ),
+ "created cf $name"
+ );
+}
+ok( $cf->load('foo'), 'load cf foo' );
+
+
+$agent->get_ok('/admin/global/select_custom_fields');
+
+for my $type ('Groups', 'Queues', 'Tickets', 'Ticket Transactions', 'Users') {
+ ok( $agent->find_link( text => $type ), "find link $type" );
+}
+
+$agent->follow_link_ok(
+ {
+ text => 'Tickets',
+ url_regex => qr{global/select_custom_fields}
+ },
+ 'follow Tickets link'
+);
+my $moniker = 'global_select_cfs';
+$agent->fill_in_action_ok( $moniker, 'cfs' => $cf->id );
+$agent->submit;
+$agent->content_contains( ( 'Updated custom fields selection')x2 );
+
+my $object_cfs =
+ RT::Model::ObjectCustomFieldCollection->new(
+ current_user => RT->system_user );
+$object_cfs->find_all_rows;
+$object_cfs->limit_to_object_id( 0 );
+$object_cfs->limit_to_lookup_type('RT::Model::Queue-RT::Model::Ticket');
+ok( $object_cfs->has_entry_for_custom_field( $cf->id ),
+ 'we did select foo' );
+
diff --git a/t/web/admin/global_jifty.t b/t/web/admin/global_jifty.t
new file mode 100644
index 0000000..ea63314
--- /dev/null
+++ b/t/web/admin/global_jifty.t
@@ -0,0 +1,10 @@
+#!/usr/bin/env perl
+
+use strict;
+use RT::Test strict => 0, tests => 4, l10n => 1;
+
+my ( $baseurl, $agent ) = RT::Test->started_ok;
+ok( $agent->login, 'logged in' );
+
+$agent->get_ok('/admin/global/config_jifty');
+ok( $agent->moniker_for('RT::Action::Config'), 'found moniker' );
diff --git a/t/web/admin/global_myrt.t b/t/web/admin/global_myrt.t
new file mode 100644
index 0000000..0b594f9
--- /dev/null
+++ b/t/web/admin/global_myrt.t
@@ -0,0 +1,20 @@
+#!/usr/bin/env perl
+
+use strict;
+use RT::Test strict => 0, tests => 5, l10n => 1;
+
+my ( $baseurl, $agent ) = RT::Test->started_ok;
+ok( $agent->login, 'logged in' );
+
+$agent->get_ok('/admin/global/my_rt');
+my $moniker = 'global_config_my_rt';
+$agent->fill_in_action_ok(
+ $moniker,
+ summary => 'component-CreateTicket',
+);
+
+$agent->submit;
+$agent->content_contains(
+ 'Updated myrt', 'updated myrt'
+);
+
diff --git a/t/web/admin/global_rights.t b/t/web/admin/global_rights.t
new file mode 100644
index 0000000..eb158d9
--- /dev/null
+++ b/t/web/admin/global_rights.t
@@ -0,0 +1,66 @@
+#!/usr/bin/env perl
+
+use strict;
+use RT::Test strict => 0, tests => 15, l10n => 1;
+
+my ( $baseurl, $agent ) = RT::Test->started_ok;
+ok( $agent->login, 'logged in' );
+
+my $root = RT::Model::User->new( current_user => RT->system_user );
+ok( $root->load('root'), 'load user root' );
+
+# edit user rights
+my $user_foo = RT::Test->load_or_create_user(
+ name => 'user_foo',
+ password => 'password',
+);
+ok( $user_foo->id, 'loaded or created user_foo' );
+ok( !$user_foo->has_right( right => 'CreateTicket', object => RT->system ),
+ 'no CreateTicket right for user_foo' );
+
+my $group_foo = RT::Model::Group->new;
+$group_foo->load_acl_equivalence($user_foo);
+
+$agent->get_ok('/admin/global/user_rights');
+my $moniker = 'global_edit_user_rights';
+$agent->fill_in_action_ok( $moniker,
+ 'rights_' . $group_foo->id => 'CreateTicket' );
+$agent->submit;
+$agent->content_contains( ('Updated rights') x 2 );
+RT::Model::Principal->invalidate_acl_cache();
+ok(
+ $user_foo->has_right(
+ right => 'CreateTicket',
+ object => RT->system
+ ),
+ 'CreateTicket right for user_foo'
+);
+
+# edit global rights
+my $privileged = RT::Model::Group->new( current_user => RT->system_user );
+ok( $privileged->load_system_internal('privileged'), 'load group privileged' );
+
+ok(
+ !$privileged->principal->has_right(
+ right => 'CreateTicket',
+ object => RT->system
+ ),
+ 'no CreateTicket right for privileged'
+);
+
+$agent->get_ok('/admin/global/group_rights');
+my $moniker = 'global_edit_group_rights';
+$agent->fill_in_action_ok( $moniker,
+ 'rights_' . $privileged->id => 'CreateTicket' );
+$agent->submit;
+$agent->content_contains( ('Updated rights') x 2 );
+
+RT::Model::Principal->invalidate_acl_cache();
+ok(
+ $privileged->principal->has_right(
+ right => 'CreateTicket',
+ object => RT->system
+ ),
+ 'CreateTicket right for privileged'
+);
+
diff --git a/t/web/admin/global_system.t b/t/web/admin/global_system.t
new file mode 100644
index 0000000..5a6b2e7
--- /dev/null
+++ b/t/web/admin/global_system.t
@@ -0,0 +1,18 @@
+#!/usr/bin/env perl
+
+use strict;
+use RT::Test strict => 0, tests => 6, l10n => 1;
+
+my ( $baseurl, $agent ) = RT::Test->started_ok;
+ok( $agent->login, 'logged in' );
+
+$agent->get_ok('/admin/global/system');
+$agent->follow_link_ok( { text => 'Base' }, 'follow Base link' );
+my $moniker = 'global_config_system';
+$agent->fill_in_action_ok(
+ $moniker,
+ rtname => q{'foo'},
+);
+$agent->submit;
+
+is( RT->config->get('rtname'), 'foo', 'rtname is updated' );
diff --git a/t/web/admin/global_templates.t b/t/web/admin/global_templates.t
new file mode 100644
index 0000000..8cb6f00
--- /dev/null
+++ b/t/web/admin/global_templates.t
@@ -0,0 +1,35 @@
+#!/usr/bin/env perl
+
+use strict;
+use RT::Test strict => 0, tests => 14, l10n => 1;
+
+my ( $baseurl, $agent ) = RT::Test->started_ok;
+ok( $agent->login, 'logged in' );
+
+$agent->get_ok('/admin/global/templates/');
+
+ok( $agent->find_link( text => 'Blank' ), "Blank link" );
+
+my $moniker = $agent->moniker_for('RT::Action::CreateTemplate');
+$agent->fill_in_action_ok(
+ $moniker,
+ 'name' => 'template_foo',
+ content => 'blabla',
+);
+$agent->submit;
+$agent->content_contains( 'Created', 'created template_foo' );
+my $template_foo = RT::Model::Template->new( current_user => RT->system_user );
+ok( $template_foo->load('template_foo'), 'load template_foo' );
+is( $template_foo->name, 'template_foo', 'did create template_foo' );
+is( $template_foo->content, 'blabla', 'content of template_foo' );
+
+$agent->follow_link_ok( { text => 'template_foo' },
+ "follow template_foo link" );
+$moniker = $agent->moniker_for('RT::Action::UpdateTemplate');
+$agent->fill_in_action_ok( $moniker, name => 'template_bar' );
+$agent->submit;
+$agent->content_contains( 'Updated', 'updated template' );
+my $template_bar = RT::Model::Template->new( current_user => RT->system_user );
+ok( $template_bar->load('template_bar'), 'load template template_bar' );
+is( $template_bar->name, 'template_bar', 'renamed to template_bar' );
+
diff --git a/t/web/admin/global_workflows.t b/t/web/admin/global_workflows.t
new file mode 100644
index 0000000..deb333a
--- /dev/null
+++ b/t/web/admin/global_workflows.t
@@ -0,0 +1,83 @@
+#!/usr/bin/env perl
+
+use strict;
+use RT::Test strict => 0, tests => 22, l10n => 1;
+
+my ( $baseurl, $agent ) = RT::Test->started_ok;
+ok( $agent->login, 'logged in' );
+
+$agent->get_ok('/admin/global/workflows/');
+
+ok(
+ $agent->find_link(
+ text => 'default',
+ url_regex => qr{/admin/global/workflows/},
+ ),
+ "default link"
+);
+
+my $moniker = $agent->moniker_for('RT::Action::CreateWorkflow');
+$agent->fill_in_action_ok( $moniker, 'name' => 'workflow_foo', );
+$agent->submit;
+$agent->content_contains( 'Created', 'created workflow_foo' );
+my $workflow_foo = RT::Workflow->new( current_user => RT->system_user );
+ok( $workflow_foo->load('workflow_foo'), 'load workflow_foo' );
+is( $workflow_foo->name, 'workflow_foo', 'did create workflow_foo' );
+
+$agent->follow_link_ok( { text => 'workflow_foo' }, "follow Transitions link" );
+
+# Modify Statuses
+$agent->follow_link_ok( { text => 'Modify Statuses' },
+ 'follow Modify Statuses link' );
+$moniker = 'workflow_edit_statuses';
+$agent->fill_in_action_ok(
+ $moniker,
+ active => 'open',
+ inactive => 'resolved',
+ initial => 'new',
+);
+
+$agent->submit;
+$agent->content_contains( 'Updated', 'updated workflow statuses' );
+
+# Modify Transitions
+$agent->follow_link_ok( { text => 'Transitions' }, "follow Transitions link" );
+$moniker = 'workflow_edit_transitions';
+$agent->fill_in_action_ok(
+ $moniker,
+ 'new' => 'open',
+ 'open' => 'resolved',
+ 'resolved' => 'open',
+);
+
+$agent->submit;
+$agent->content_contains( ('Updated workflow transitions') x 2 );
+
+# Interface
+$agent->follow_link_ok( { text => 'Interface' }, "follow Interface link" );
+$moniker = 'workflow_edit_interface';
+$agent->fill_in_action_ok(
+ $moniker,
+ 'new___label___open' => 'open',
+ 'new___action___open' => 'respond',
+);
+$agent->submit;
+$agent->content_contains( ('Updated workflow interface') x 2 );
+
+# Mappings
+$agent->follow_link_ok( { text => 'Summary' }, "follow Summary link" );
+$agent->follow_link_ok(
+ { url_regex => qr{workflows/mappings\?from=default&to=workflow_foo} },
+ "follow Mappings link" );
+
+$moniker = 'workflow_edit_mappings';
+$agent->fill_in_action_ok(
+ $moniker,
+ from_stalled => 'open',
+ from_deleted => 'resolved',
+ from_rejected => 'resolved',
+);
+
+$agent->submit;
+$agent->content_contains( ('Updated workflow mappings') x 2 );
+
-----------------------------------------------------------------------
More information about the Rt-commit
mailing list