[Rt-commit] rt branch, 4.2/rest-ticket-content-type, updated. rt-4.0.6-338-g722a8bc

? sunnavy sunnavy at bestpractical.com
Wed Jun 13 23:57:48 EDT 2012


The branch, 4.2/rest-ticket-content-type has been updated
       via  722a8bcf35a620f2c4f7fee140fa86326026f3ce (commit)
      from  cbe383b4c8da003b897e01fa5166ed85f06fcb38 (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 722a8bcf35a620f2c4f7fee140fa86326026f3ce
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