[Rt-commit] rt branch, 4.0/rest-ticket-content-type, updated. rt-4.0.6-170-g0442cb2

? sunnavy sunnavy at bestpractical.com
Wed Jun 13 23:56:17 EDT 2012


The branch, 4.0/rest-ticket-content-type has been updated
       via  0442cb2327384cc58ec6c9066a603b370cec16a5 (commit)
      from  d7687259b2b9db2e6b2be1184fc6cf3d241ddcdf (commit)

Summary of changes:
 t/web/command_line_ticket_content_type.t |   49 ++++++++++++++++++++++++++++++
 1 file changed, 49 insertions(+)
 create mode 100644 t/web/command_line_ticket_content_type.t

- Log -----------------------------------------------------------------
commit 0442cb2327384cc58ec6c9066a603b370cec16a5
Author: sunnavy <sunnavy at bestpractical.com>
Date:   Thu Jun 14 11:27:18 2012 +0800

    command line test of content-type in ticket creating/commenting

diff --git a/t/web/command_line_ticket_content_type.t b/t/web/command_line_ticket_content_type.t
new file mode 100644
index 0000000..411eb08
--- /dev/null
+++ b/t/web/command_line_ticket_content_type.t
@@ -0,0 +1,49 @@
+
+use strict;
+use Test::Expect;
+use RT::Test tests => 22, actual_server => 1;
+my ( $baseurl, $m ) = RT::Test->started_ok;
+$m->login();
+
+my $rt_tool_path = "$RT::BinPath/rt";
+
+$ENV{'RTUSER'}   = 'root';
+$ENV{'RTPASSWD'} = 'password';
+$ENV{'RTSERVER'} = RT->Config->Get('WebBaseURL');
+$ENV{'RTCONFIG'} = '/dev/null';
+
+# create a ticket
+expect_run(
+    command => "$rt_tool_path shell",
+    prompt  => 'rt> ',
+    quit    => 'quit',
+);
+
+for my $content_type ( 'text/plain', 'text/html' ) {
+    expect_send(
+        qq{create -t ticket -ct $content_type set subject='new ticket' text=foo},
+        "creating a ticket with content-type $content_type"
+    );
+
+    expect_like( qr/Ticket \d+ created/, "created the ticket" );
+    expect_handle->before() =~ /Ticket (\d+) created/;
+    my $id = $1;
+    ok( $id, "got ticket $id" );
+
+    $m->goto_ticket($id);
+    $m->follow_link_ok( { text => 'with headers', n => 1 } );
+    $m->content_contains( "Content-Type: $content_type", 'content-type' );
+
+    expect_send(
+        qq{comment ticket/$id -ct $content_type -m bar},
+        "commenting a ticket with content-type $content_type"
+    );
+    expect_like( qr/Message recorded/, "commented the ticket" );
+
+    $m->goto_ticket($id);
+    $m->follow_link_ok( { text => 'with headers', n => 2 } );
+    $m->content_contains( "Content-Type: $content_type", 'content-type' );
+}
+
+expect_quit();
+1;    # needed to avoid a weird exit value from expect_quit

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


More information about the Rt-commit mailing list